phoenix_storybook
phoenix_storybook copied to clipboard
add the option to only add and build storybook in development
see discussion here: https://elixirforum.com/t/phoenix-storybook-a-storybook-like-ui-interface-for-phoenix-components/48890/52?u=tcoopman
For me the reason is that I want to use storybook for a project that is not open source and doesn't share it's components. Here storybook is still a great way of showing all the possible components and creating a great style guide.
Hey Thomas, 6 months later, here I am! 🤪 Do you think these two setting tweaks would be enough?
- In
router.ex
, mount the storybook only in dev.
if Application.compile_env!(:my_app, :env) == :dev do
live_storybook "/dev/storybook", [...]
end
- In the application's
storybook.ex
file, set the storycompilation_mode
to:lazy
, so that stories are only compiled when used (ie. never in production)
WDYT?
I'll try to have a look at it sooner than in 6 months 😂
The router trick I'm already using but the lazy compiling looks useful. I'll try it out!
ok, I just set myself a reminder to come back here by April 10, 2024
Just a 👍 for this (timely since your reminder date is in 5 days). Storybook compilation adds about 1 minute to all of our CI runs, and as this is just wasted time and expense we'd love to have a way to avoid this. Thanks.
To echo on @neilberkman 's comment, we tried the suggested steps and compilation_mode: :lazy
helps in cutting the number of compiled assets.
However, as the doc states, we still compile .index.exs
, ideally we wouldn't.
In our case, we partition test, so for instance, we're compiling this file 4 times for each PR.
I think we want to be able to not start the compiler in some environments?
The people has spoken! I'll have a look next week ;-)