2.0.0 • Published 3 years ago

@storybook/addon-postcss v2.0.0

Weekly downloads
2,254
License
MIT
Repository
github
Last release
3 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-componentaranghat-reactcomplibgamari-uitailwind-tales-addonwidgetxrwdp-ui-storybook-componentswebcmp-topo-chart-horizontalwx-uidesigntechco-chat-widgetst_dt_11storeberry-ui-componentsstoreberry-ui-components-betastoreberry-ui-components-test-onestory-components-vpstorybook-design-system-rajamanimarantesting-prtexesvelte-component-library-asimedvapor-test-123cccar-components-uiiwish-cdd-frontendjrs-libjenika-ui-reactjord-inc-storybookjord_global_pickers_newkyc-shipfinex-dev-1ibvitinfo-build-storybookinflectionpoints-uihh-ui-componentslfat-my-storybook-componentsmanolis-uimat-designmatacapital-uimaasivo-ui@wesbitty/ui@withvoyage/slate-ui@tkxs/cast-ui@teldatlabs/teldat-ui@theforeman/stories@timvdeijnden/storybook@timothyneiljohnson/solidarity-ui-storage-dark-mode@timothyneiljohnson/solidarity-ui-search-typeahead@timothyneiljohnson/solidarity-ui-media-queries@timothyneiljohnson/solidarity-ui@vfriganiotis/iyc-css-framework@youpal-design-system/design-system@zalastax/nolb-_stor@zebrainy/react-components2alex-unicodeambee-ui-systemv2ambee-ui-library2ambee-ui-systemambee-ui-system_v1aag-my-storybook-componentsalchera-ui-componentannexcloud-loyalty-v3annexcloud-loyalty@gowthamraj2399/chat-widget@goodrequest/antd-form-fields@azevedoluis2001/my-first-lib@greg1880/react-design-system-teste@greg1990/react-design-system2@atelypham/webb-ui-components@adox/adox-design-system@edgelogistics/web-ui@ef2/content-components-react@ef2/react@alex9923/react-pdf-table@america-transparente/ui@infotition/tsisafwan-ui@bbl-digital/snorre-v2stephanie-storybook-tablrstephanie-storybook-tutorialtruixui-v2@bandit-network/react-ui-kit@bricksandbraces/designsystem@cheapreats/react-uiz-meitav-libyash-components@dvdcpp/testsum@gokul1630/react@leaseotb/ui-components@nemethricsi/reach-ui@sentrei/storybookmx-ui-componentsmevo-componentsotro-publicadonypr-design-system-vueocto-shiny-storybook
3.0.0-alpha.1

3 years ago

3.0.0-alpha.0

3 years ago

2.0.0

5 years ago

1.0.0

5 years ago