Add ability to hide dev-only stories from the production storybook #12971
Labels
proposal: accepted
This request has gone through triaging and we are accepting PR's against it.
role: dev 🤖
type: docs 📖
type: enhancement 💡
In some instances, it's helpful to add a story to the storybook for development and testing purposes. These stories are not helpful to the consumer though, and would promote confusion if included in the production site/build.
For these cases, it would be nice if there was a way to add these stories, but have them in a special section that is not included in the production build.
#12971 (comment)
A few potential approaches
Use a environment flag to turn on/off dev mode
Option A:
Author stories in
*.dev.stories.js
files, and exclude these from the build in.storybook/main.js
Option B:
Author stories in the same file as production stories, but add a flag/prefix to their names, e.g.
DEV_ReadOnlyInputExamples
excludeStories
optionexcludeStories: process.env.DEV_MODE ? /.*DEV$/ : [],
in each story fileDEV_
(or similar) prefixI think ultimately the best approach right now could be to add the environment flag, and use option B
Concerns
Examples of stories that would be nice to have in a dev-only mode
The text was updated successfully, but these errors were encountered: