Skip to content

Instantly share code, notes, and snippets.

@ademilter
Last active September 7, 2021 12:11
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ademilter/5f56fe9e56c5eb8725292274c68001c5 to your computer and use it in GitHub Desktop.
Save ademilter/5f56fe9e56c5eb8725292274c68001c5 to your computer and use it in GitHub Desktop.
postcss config for storybook
- webpack.config.js
- postcss.config.js
- config.js
- addons.js
import { configure } from '@storybook/react'
import '../src/styles/main.css'
const req = require.context('../stories', true, /.stories.js$/)
function loadStories() {
req.keys().forEach(filename => req(filename))
}
configure(loadStories, module)
module.exports = {
plugins: {
// PostCSS Preset Env includes autoprefixer and browsers option will be passed to it automatically.
'postcss-preset-env': {
stage: 0,
browsers: 'last 2 versions'
// importFrom: 'path/to/file.css'
},
'postcss-import': {},
'postcss-nested': {}
}
}
module.exports = {
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
options: { sourceMap: true }
},
{
loader: 'css-loader',
options: { sourceMap: true }
},
{
loader: 'postcss-loader',
options: {
sourceMap: true,
config: {
path: './.storybook/'
}
}
}
]
}
]
}
}
@saidsoualhi
Copy link

Anyone has configuration postcss for Angular?

@TomSssM
Copy link

TomSssM commented Sep 7, 2021

@Abramovick you saved my life 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment