@lwce/lwc-storybook-cli

0.6.22 • Public • Published

LWC Storybook CLI

A CLI tool for quickly getting started with storybook in LWC projects

Getting started

  1. Add lwc-storybook-cli as a dependency to your project:
npm install --save-dev @lwce/lwc-storybook-cli

# OR

yarn add --dev @lwce/lwc-storybook-cli
  1. Add to your package.json:
"scripts": {
  "storybook:build": "lwc-storybook build",
  "storybook:start": "lwc-storybook start",
}
  1. Make sure your lwc.config.json has the following module entry:
"modules": [
    ...
    {
        "npm": "lwc-components-lightning"
    }
],
  1. Optionally, add a mocked-core-modules-data.js file to the root of your project. The file should export a single getData function:
export function getData() {
    return {
        // Any data defined will be provided to the mocked core modules
    }
}
  1. Add .storybook to your .gitignore

Commands

start

Start storybook in development mode

Command: lwc-storybook start

build

Build storybook with an output that can be hosted on a static web server. Defaults the output to .storybook/build/public

Command: lwc-storybook build

story

Follow the prompts to generate a story

Command: lwc-storybook story

Readme

Keywords

none

Package Sidebar

Install

npm i @lwce/lwc-storybook-cli

Weekly Downloads

0

Version

0.6.22

License

BSD-3-Clause

Unpacked Size

78.6 kB

Total Files

33

Last publish

Collaborators

  • vkotari
  • sf_mjhaveri
  • blittle
  • priandsf
  • seckardt
  • bhavesh-kumar