mix phoenix_storybook.install (phoenix_storybook v1.5.0)

Copy Markdown View Source

Installs PhoenixStorybook into a Phoenix application

Generates the storybook scaffolding (the same files as mix phx.gen.storybook) and applies the whole manual setup automatically:

  • a storybook backend in lib/my_app_web/storybook.ex
  • storybook assets in assets/js/storybook.js and assets/css/storybook.css (copied from your app.css so components render the same in the storybook)
  • example stories in storybook/ for your core components
  • router: import PhoenixStorybook.Router, storybook_assets() and live_storybook/2
  • the CSS sandbox class on the <body> of your root layout
  • config.exs: js/storybook.js esbuild entry point and a :storybook tailwind profile
  • dev.exs: a tailwind watcher, and a live_reload pattern for stories (in runtime.exs for apps generated with phx_new >= 1.8.9)
  • .formatter.exs: :phoenix_storybook import and storybook/**/*.exs inputs
  • mix.exs: storybook tailwind build in the assets.build and assets.deploy aliases

The esbuild and tailwind specific parts are skipped when the project has no :esbuild / :tailwind dependency.

Example

mix igniter.install phoenix_storybook

Options

  • --no-tailwind - skip the TailwindCSS specific setup