Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Configuring colocated stories #30

Open
joshwcomeau opened this issue Jan 6, 2017 · 1 comment
Open

Configuring colocated stories #30

joshwcomeau opened this issue Jan 6, 2017 · 1 comment
Labels

Comments

@joshwcomeau
Copy link

Hi,

I'm using React CDK for a collection of components, and I'd like to colocate the stories:

src
|-- components
|---|-- Button
|---|---|-- Button.js
|---|---|-- Button.test.js
|---|---|-- Button.stories.js
|---|-- Input
|---|---|-- Input.js
|---|---|-- Input.test.js
|---|---|-- Input.stories.js

In .storybook/config, I can simply update the loadStories function to do something like this:

const components = require.context('../src/components', true, /.stories.js$/);

function loadStories() {
  components.keys().forEach(filename => components(filename));
}

This works great, but there's a warning at the top of ./storybook/config:

// IMPORTANT
// ---------
// This is an auto generated file with React CDK.
// Do not modify this file.

I'm afraid that my changes will be overwritten, or at the very least, that there's a better way to do this. Please let me know :)

@usulpro
Copy link
Member

usulpro commented Mar 30, 2017

@joshwcomeau It'll be overwritten if you update your project. If you're not going to do it feel free to setup your project as you need :)

But I'm sure we should think about to provide an ability to do such customization like it's done for .scripts/prepublish.sh

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants