This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@studiometa/storybook-twig
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.0 • Public • Published

Storybook for Twig/Twing

Storybook for Twig/Twing is a UI development environment for your Twig/Twing components. With it, you can visualize different states of your UI components and develop them interactively.

Storybook Screenshot

Storybook runs outside of your app. So you can develop UI components in isolation without worrying about app specific dependencies and requirements.

Getting Started

Step 1: Add dependencies

cd my-melody-app
npm install @studiometa/storybook-twig --save-dev

Step 2: Add a npm script

In your package.json, add the following npm script to start storybook:

{
  "scripts": {
    "storybook": "start-storybook"
  }
}

Step 3: Create the main file

Create the .storybook/main.js file to tell Storybook where to find your stories:

module.exports {
    stories: ['../src/**/*.stories.[tj]s'],
    twigOptions: {

    }
};

You can also define a custom Twing environment:

// .storybook/main.js
module.exports {
    twigOptions: {
      environmentModulePath: require.resolve('./my-custom-twig-environment.js'),
    },
    stories: ['../src/**/*.stories.[tj]s'],
};

// .storybook/my-custom-twig-environment.js (default environment as example)
const { TwingEnvironment, TwingLoaderRelativeFilesystem } = require('twing');

const loader = new TwingLoaderRelativeFilesystem();
const twig = new TwingEnvironment(loader);

module.exports = twig;

Step 4: Write your stories

import Button from './button.twig';

export default {
  title: 'Button',
  component: Button,
};

export const withText = () => ({
  props: { label 'some text' }
});

export const withEmoji = () => ({
  props: { label '😀 😎 👍 💯' }
});

For more information visit: storybook.js.org


Storybook also comes with a lot of addons and a great API to customize as you wish. You can also build a static version of your storybook and deploy it anywhere you want.

Here are some featured storybooks that you can reference to see how Storybook works:

Docs

Readme

Keywords

Package Sidebar

Install

npm i @studiometa/storybook-twig

Weekly Downloads

25

Version

1.0.0-alpha.0

License

none

Unpacked Size

14.6 kB

Total Files

26

Last publish

Collaborators

  • jeremiewerner