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.jsandassets/css/storybook.css(copied from yourapp.cssso components render the same in the storybook) - example stories in
storybook/for your core components - router:
import PhoenixStorybook.Router,storybook_assets()andlive_storybook/2 - the CSS sandbox class on the
<body>of your root layout config.exs:js/storybook.jsesbuild entry point and a:storybooktailwind profiledev.exs: a tailwind watcher, and a live_reload pattern for stories (inruntime.exsfor apps generated with phx_new >= 1.8.9).formatter.exs::phoenix_storybookimport andstorybook/**/*.exsinputsmix.exs: storybook tailwind build in theassets.buildandassets.deployaliases
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