Giter Club home page Giter Club logo

parcel-storybook's Introduction

parcel-storybook

full storybook (preview + manager including addons!) bundled by parceljs instead of webpack

features (thanks to parceljs :) )

  1. zero config react + typescript support (no babel, no webpack or any other config)
  2. glob import all stories (*.stories.ts), see ./storybook/iframe.ts
  3. fast bundling -- fast storybook preview bundling thanks to parceljs -- storybook manager prebuilt and included in git (approach used by snowpack and yarn 2 cache sharing), so no time spent to build it

usage

git clone https://github.com/vasileermicioi/parcel-storybook
cd parcel-storybook
yarn install
yarn storybook

storybook manager rebuild

if you need more addons (now only actions and knobs) you can modify ./storybook/config/main.js

yarn rebuild-manager
yarn storybook

!! don't forget to commit newly generated files !! rebuild manager only when you need to change manager config, not the preview or stories

motivation

storybook published a standalone preview powered by parceljs (see here https://github.com/storybookjs/storybook/tree/next/examples/standalone-preview) but the example is not working with the addons because the preview is inside an iframe with different origin, (see here storybookjs/storybook#8677) cross-origin requests/communication being blocked by browsers (same domain but different port is considered another origin)

running storybook with parceljs (because of it's simplicity) seems to be a popular request storybookjs/storybook#10110 storybookjs/storybook#8677 storybookjs/storybook#5975 (comment)

posible solutions

main problem is to fix cross-origin communication, I was able to solve that in 2 ways

  1. reverse proxy both the manager and the preview so they are in the same domain
  2. build static manager (how often are you changing storybook config?) and serving / watching only the preview having storybook manager as static assets

so current repo is solved using second approach

parcel-storybook's People

Contributors

vasileermicioi avatar

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.