SelectoComponents.Colocated (selecto_components v0.4.5)

Configuration and utilities for colocated JavaScript and hooks in SelectoComponents.

This module provides functions to:

  • List all available colocated hooks
  • Generate JavaScript imports for the host application
  • Configure Phoenix LiveView colocated assets

Link to this section Summary

Functions

Returns configuration for the host application's app.js file.

Checks if Phoenix LiveView supports colocated assets.

Generates JavaScript code to import and export all colocated hooks.

Returns a list of all available colocated hooks.

Returns the path where colocated hooks should be extracted.

Link to this section Functions

Link to this function

app_js_config()

Returns configuration for the host application's app.js file.

This includes the necessary imports and hook registrations.

Link to this function

check_phoenix_live_view_support()

Checks if Phoenix LiveView supports colocated assets.

Returns {:ok, version} or {:error, reason}

Link to this function

generate_hooks_index()

Generates JavaScript code to import and export all colocated hooks.

This is used by the setup task to create the hooks index file.

Returns a list of all available colocated hooks.

Each hook is a tuple of {module_name, hook_name, file_path}

Link to this function

hooks_output_path()

Returns the path where colocated hooks should be extracted.