mix live_filter.install.assets (LiveFilter v0.1.0)

View Source

Installs LiveFilter JavaScript assets to your Phoenix application.

This task copies JavaScript hooks from the LiveFilter library to your application's assets directory so they can be imported and used with Phoenix LiveView.

Usage

$ mix live_filter.install.assets

This will copy the LiveFilter JavaScript hooks to:

assets/js/hooks/live_filter/

Integration

After running this task, add the unified hook to your app.js:

import LiveFilter from "./hooks/live_filter/live_filter"

let liveSocket = new LiveSocket("/live", Socket, {
  hooks: { LiveFilter }
})

Included Files

  • live_filter.js - Unified hook for all LiveFilter components (recommended)
  • date_calendar_position.js - Legacy hook for backward compatibility
  • index.js - Module exports for both approaches

Migration from Legacy Hooks

If you're upgrading from an older version that used individual hooks:

  1. Replace import DateCalendarPosition from "./hooks/live_filter/date_calendar_position"
  2. With import LiveFilter from "./hooks/live_filter/live_filter"
  3. Update hooks: { DateCalendarPosition } to { LiveFilter }

The old hooks remain available for backward compatibility.