Skip to content

Commit

Permalink
import stories from modules/**/stories*.js
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnbot committed Sep 12, 2017
1 parent 56d4d89 commit 6afabb3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions .storybook/config.js
Expand Up @@ -8,10 +8,15 @@ setOptions({
showDownPanel: false,
})

const req = require.context('.', true, /\.js$/)
const contexts = [
require.context('.', true, /\.js$/),
require.context('../modules', true, /stories.*\.js$/),
]

const load = () => {
req.keys().forEach(req)
}

configure(load, module)
configure(() => {
contexts.forEach(context => {
context.keys()
.filter(key => !key.includes('node_modules'))
.forEach(context)
})
}, module)

0 comments on commit 6afabb3

Please sign in to comment.