Storybook: Autoload all /.story.js$/

Created on 10 May 2017  路  8Comments  路  Source: storybookjs/storybook

Instead of having consumers require every story file, we can do a glob-pattern match and auto-load.

This is consistent with how tools like jest work.

discussion feature request merged

Most helpful comment

I would rather have an addon that auto loads all my stories when instructed rather than have this behaviour applied by default

All 8 comments

Another common idiom I see is *.stories.js, but I'd be happy if we agree on a single naming scheme.

IMO it should be able to load any of:
*.stories.js, *.story.js, story.js, stories.js

A use-case where you want story.js or stories.js is something like:

  • components

    • text-field

    • index.js

    • styles.js

    • stories.js

    • button

    • index.js

    • styles.js

    • stories.js

I would rather have an addon that auto loads all my stories when instructed rather than have this behaviour applied by default

I think the *.jsx extension should be added as well.

If we talk about add this pattern to "getstorybook" as default, I think It's great. It allows people to start writing stories just after adding storybook to their project but also lefts flexibility of manual customization

I'm gonna toss it into the cli for 3.3.

@danielduan that sounds great!

In #1209 I'd also like the visit the idea of configuring this in a config, much like how you set a testPattern for jest.

Works in 3.3.0-alpha.4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sakulstra picture sakulstra  路  3Comments

wahengchang picture wahengchang  路  3Comments

tirli picture tirli  路  3Comments

tomitrescak picture tomitrescak  路  3Comments

shilman picture shilman  路  3Comments