Handles automatic JavaScript integration for PhoenixKit installation.
This module provides functionality to:
- Add PhoenixKit JS import for hooks and interactive features
- Update liveSocket hooks configuration automatically
- Ensure idempotent operations (safe to run multiple times)
- Provide fallback instructions if automatic integration fails
Import Strategy
PhoenixKit JavaScript is imported directly from the deps directory, similar to CSS.
This means updates to PhoenixKit automatically include updated JavaScript without
needing to run phoenix_kit.update.
The import path is relative to your app.js location:
assets/js/app.js→import "../../deps/phoenix_kit/priv/static/assets/phoenix_kit.js"priv/static/assets/app.js→import "../../../deps/phoenix_kit/priv/static/assets/phoenix_kit.js"
Summary
Functions
Automatically integrates PhoenixKit JavaScript with the parent app's app.js.
Checks what PhoenixKit JS integration already exists in content. Returns a map with detected integrations.