mix phoenix_datastar.install (PhoenixDatastar v0.2.0)

Copy Markdown View Source

Installs PhoenixDatastar into your Phoenix application.

Usage

mix phoenix_datastar.install

This will:

  1. Add :phoenix_datastar to import_deps in .formatter.exs
  2. Add the Registry to your application's supervision tree
  3. Enable stripping of debug annotations in dev (for SSE patches)
  4. Add import PhoenixDatastar.Router to your router
  5. Add "sse" to the browser pipeline's :accepts plug
  6. Add the global /__datastar scope with StreamPlug and NavPlug routes
  7. Add def live_datastar and def datastar to your web module
  8. Add the Datastar JavaScript to your root layout