@fluentui/babel-preset-storybook-full-source
v0.1.2
Published
Babel preset that adds the makes the full source code of stories available
Downloads
3,046
Maintainers
Keywords
Readme
@fluentui/babel-preset-storybook-full-source
Babel Preset Storybook Full Source for Fluent UI React
This Babel preset makes the full source code of stories available by adding the context.parameters.fullSource property to Storybook stories. This property contains the source of the file where the story is present.
Usage
To use this Babel preset, add it to your Babel configuration:
{
"presets": ["@fluentui/babel-preset-storybook-full-source"]
}Features
- Removes Storybook specific assignments: Avoids issues with undefined stories and unnecessary clutter.
- Collects and modifies import declarations: Ensures valid single-file code examples.
- Adds the
context.parameters.fullSourceproperty: post-processed, single-file source for the "Open in Sandbox" flow. - CSS module support (opt-in via
cssModulesoption): when enabled, reads*.module.cssfiles from disk and injectscontext.parameters.cssModuleSourceswith{ cssModules, tokensSource }entries for the sandbox addon and docs panel. SetcssModules: trueto enable, orcssModules: { tokensFilePath: '...' }to also inject a tokens CSS file astokensSource.
Note
This package is designed for Fluent UI usage only and may not be suitable for general use.
License
This project is licensed under the MIT License.
