Created
August 11, 2017 09:27
-
-
Save imekachi/f9fc80a6123844f03060269f54d0eb6f to your computer and use it in GitHub Desktop.
dynamically load stories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { configure } from '@storybook/react' | |
| // each filename returns as "./_Component.js" | |
| const req = require.context('../src/stories', true, /^(\.\/_)(.+)(\.js$)/) | |
| // Explicitly require load stories | |
| // function loadStories() { | |
| // // require('../src/stories'); | |
| // req.keys().forEach(filename => req(filename)) | |
| // } | |
| // Dynamically load stories | |
| function loadStories() { | |
| req.keys().forEach(filename => req(filename)) | |
| } | |
| configure(loadStories, module) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment