-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostCSS/CSSmodules css not loading in Storybook #541
Comments
This is the config from my current project... const path = require('path');
// postcss
const cssnext = require('postcss-cssnext');
const postcssPartialImport = require('postcss-partial-import');
const postcssMixins = require('postcss-mixins');
const postcssSimpleVars = require('postcss-simple-vars');
const PATHS = require('../paths');
module.exports = {
resolve: {
root: [
PATHS.app,
path.resolve(__dirname, '../node_modules'),
],
},
module: {
loaders: [
{
test: /\.(png|woff|woff2|svg|ttf|eot|jpg)$/,
loader: 'file',
},
{
test: /\.css$/,
loader: 'style!css?modules=1!postcss',
},
],
},
postcss(instance) {
return [
postcssPartialImport({
dirs: [
PATHS.app,
],
addDependencyTo: instance,
}),
postcssMixins(),
postcssSimpleVars(),
cssnext(),
];
},
}; You probably don't need Since Storybook runs within a webpack'd environment, it natively runs any of those statements through loaders, so you don't have to physically remove them. ExtractTextPlugin is good for production environments (like browsers or bundling your JS into a working server-side bundle) - it's typically not needed inside of Start with my config above and hack away at the plug-ins you need. |
(This is a minor comment, but I noticed you're using |
Thanks @leebenson, your config helped me and now it works! (Concerning your remark about |
@BenSwennen so what was the issue? |
I have the following component that imports styles are generated via PostCSS and CSSmodules and works fine if I use them in my app normally, but the styles won't show up in storybook:
Here is my
webpack.config.js
(which is basically a copy of thewebpack.config.js
in root) in .storybook:Suggestions in #270 couldn't help me. Can you please tell me what I'm doing wrong?
The text was updated successfully, but these errors were encountered: