2.0.0 • Published 2 years ago

@storybook/addon-postcss v2.0.0

Weekly downloads
2,254
License
MIT
Repository
github
Last release
2 years ago

Storybook Addon PostCSS

The Storybook PostCSS addon can be used to run the PostCSS preprocessor against your stories in Storybook.

Getting Started

Install this addon by adding the @storybook/addon-postcss dependency:

yarn add -D @storybook/addon-postcss

within .storybook/main.js:

module.exports = {
  addons: ['@storybook/addon-postcss'],
};

and create a PostCSS config in the base of your project, like postcss.config.js, that contains:

module.exports = {
  // Add your installed PostCSS plugins here:
  plugins: [
    // require('autoprefixer'),
    // require('postcss-color-rebeccapurple'),
  ],
};

PostCSS 8+

If your project requires you to be using PostCSS v8, you can replace the included PostCSS by passing postcssLoaderOptions to this addon.

First, you'll need to install PostCSS v8 as a dependency of your project:

yarn add -D postcss@^8

Then, you'll need to update your addons config. Within .storybook/main.js:

module.exports = {
  addons: [
-   '@storybook/addon-postcss',
+   {
+     name: '@storybook/addon-postcss',
+     options: {
+       postcssLoaderOptions: {
+         implementation: require('postcss'),
+       },
+     },
+   },
  ]
}

When running Storybook, you'll see the version of PostCSS being used in the logs. For example:

info => Using PostCSS preset with postcss@8.2.4

Loader Options

You can specify loader options for style-loader, css-loader, and postcss-loader by passing options to this addon as styleLoaderOptions, cssLoaderOptions, or postcssLoaderOptions respectively.

You can also configure the loader rule by overriding the rule option.

alchera-storybookreactcustomlib-acraalchera-test@pasha28198/molequle-web-commonif-my-storybookflighthub-vue@simuratli/tetetepkg-components-parkingibex-components@everything-registry/sub-chunk-875mdx-component@layers.digital/layers-design-system-vue3qubit-uisimplr-storybook-librarywdp-ui-storybook-components@saiefelgebali/react-diagrams@ostoica/core-ui@palanikannan1437/rc4-ui@palanikannan1437/rc4community-timelineshipfinex-kyc-forms@rockinblocks/rockinblocksrejo-ui-componentsrejolut-ui-components@onesme/dxui@statflo/textkit-ui-librarystoreberry-ui-componentsstoreberry-ui-components-betastoreberry-ui-components-test-onestory-components-vpstephanie-storybook-tablrstephanie-storybook-tutorial@sihq/ui-components@nemethricsi/reach-uiraheel-component@magicpay/magicpay-js@magicpay/magicpay-js-publicreact-component-library2121react-gallery-maelstromraulrobi-my-storybook-componentsraycris-uirayda-ui@leaseotb/ui-componentsreact-simple-terminalreactable-uireact-signy-form-component-test-1react-signy-form-component-test-2react-sting-tempwidgetxr@sentrei/storybookwebcmp-topo-chart-horizontalst_dt_11yash-components@timvdeijnden/storybook@timothyneiljohnson/solidarity-ui-media-queries@timothyneiljohnson/solidarity-ui-search-typeahead@timothyneiljohnson/solidarity-ui-storage-dark-mode@timothyneiljohnson/solidarity-ui@tkxs/cast-ui@youpal-design-system/design-systemrenix@openbricksandbraces/designsystem@openbricksandbraces/webcomponentssample-tablr@shawnfarsai/scale-ui-vite@shawnfarsai/scale-ui@teldatlabs/teldat-uitechco-chat-widget@sudeesh/calendar@sudeesh/event-schedulerstorybook-design-system-rajamanimaran@theforeman/storiestesting-prtexetailwind-tales-addonsvelte-component-library-asimed@symbol-it/symbolit-vue-componentsz-meitav-libevreka-components-testemployee_picker_testejemplo_proyectogamari-ui@asad1381/custom-components@atelypham/webb-ui-componentsfhf-my-storybook-components@america-transparente/uifree-beefjs-pigeonhole@alex9923/react-pdf-tablegig-utilsgg-ui-temp1@azevedoluis2001/my-first-libdemo-test-app-2@ef2/react@ef2/content-components-react@edgelogistics/web-uicontentoh-components-libraryjrs-libdivyansh-componentsdesign-ui-hung1lfat-my-storybook-componentsdaiandri-react-pwr
3.0.0-alpha.1

2 years ago

3.0.0-alpha.0

2 years ago

2.0.0

3 years ago

1.0.0

3 years ago