@parachutehome/create-title.macro
v2.0.0
Published
Automatically create storybook titles using a babel macro
Downloads
6
Readme
create-title.macro
Automatically generate titles for your stories in Storybook.
This babel macro was created to streamline the developer experience when working with stories inside Storybook. The macro will automatically generate a title for your stories -- eliminating the need to write them out which can be a time saver especially when a story is nested deep inside multiple folders.
Getting Started
Install
npm i --save-dev @parachutehome/create-title.macro
If you haven't set up your project yet to support babel macros then read the guide here.
tl;dr
npm i --save-dev @parachutehome/create-title.macro babel-plugin-macros
Then in your .babelrc
:
{
"plugins": ["macros"]
}
Example Usage
// src/components/Button/Button.stories.js
import createTitle from '@parachutehome/create-title.macro';
export default {
title: createTitle(); // output: components/Button
// ...
}
Documentation
You can view the full documentation for this babel macro online here.
Contributing
If you would like to help contribute features or bug fixes to this macro, then please read the contributing guide here.
Previous Art
- https://github.com/storybookjs/paths.macro
The paths.macro, created by Storybook, served as inspiration, and a great jumping off point. Big thanks for their work!