GithubHelp home page GithubHelp logo

storybook-for-gatsby's Introduction

Storybook for Gatsby

npm npm type definitions npm bundle size

Installation

Add it to your dev dependencies with your package manager of choice:

#yarn
yarn add storybook-for-gatsby -D

#npm
npm install --save-dev storybook-for-gatsby

Then add the addon to your Storybook config at .storybook/main.js:

// .storybook/main.js

module.exports = {
  addons: ['storybook-for-gatsby'],
};

Deploying to Chromatic

Chromatic is a tool from the makers of Storybook that automates gathering UI feedback, visual testing, and documentation. Due to the way it reads information from the UI, it requires some extra steps to deploy. If you are using the useStaticQuery hook anywhere in your codebase you will need to:

  • Run a production build
  • Copy all files from your static queries
  • Build Storybook in a 'test' NODE_ENV

The below snippet shows how you can achieve this in your package.json

// package.json

{
  "scripts": {
    "copy-static-queries": "cp -r ./public/page-data/sq/d ./public/static",
    "build-storybook": "gatsby build && yarn copy-static-queries && NODE_ENV=test build-storybook"
  }
}

Limitations

  • Gatsby v4 or above
  • Storybook to be configured for Webpack 5 (Storybook with Webpack 5 docs)
  • Not tested on Storybook 7 (not even sure if its needed)

Contributors

jpwallace22
Justin Wallace
dslovinsky
Daniel Slovinsky

storybook-for-gatsby's People

Contributors

jpwallace22 avatar

Stargazers

 avatar

Watchers

 avatar

storybook-for-gatsby's Issues

New addon framework

The Storybook API for building addons is currently being updated to factor in the changes introduced by the upcoming 7.0 release. There are required changes to help the community from benefiting from using the addon, there is an abridged guide for the required changes here. Questions or issues: #prerelease channel in Discord Server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.