Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation instructions are not conform with Storybook CSF file name best practices #16

Open
oligafner opened this issue Nov 30, 2021 · 0 comments

Comments

@oligafner
Copy link

The installation instructions in the README.md could be improved by including story files that conform with naming best practices at https://storybook.js.org/docs/react/writing-stories/introduction#where-to-put-stories.

At https://github.com/atlassian-labs/babel-plugin-storybook-csf-title#installation

/* add plugin to babel, however disable it by default */
plugins: [
    ['babel-plugin-storybook-csf-title', false], 
],
/* enable the plugin for all files that match your story name pattern */
overrides: [{ 
    include: /\/stories\.(ts|tsx)$/, 
    plugins: [
        ['babel-plugin-storybook-csf-title', { toTitle: require('./your-to-title-function') }]
    ]
}]

should be changed from including a title attribute on every file that matches with /stories.ts or /stories.tsx to including a title attribute on every file that matches with .stories.ts or .stories.ts as it is best practice to name your story something like my-snowflake-component.stories.ts and not have a sub folder with a stories.ts file in it.

/* add plugin to babel, however disable it by default */
plugins: [
    ['babel-plugin-storybook-csf-title', false], 
],
/* enable the plugin for all files that match your story name pattern */
overrides: [{ 
    include: /\.stories\.(ts|tsx)$/, 
    plugins: [
        ['babel-plugin-storybook-csf-title', { toTitle: require('./your-to-title-function') }]
    ]
}]

This would have saved me a lot of debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant