Skip to content
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

Docs request: Using CSS Modules with extract-text-webpack-plugin #25

Open
kevinSuttle opened this issue Apr 27, 2016 · 5 comments
Open

Comments

@kevinSuttle
Copy link

kevinSuttle commented Apr 27, 2016

loader: ExtractTextPlugin.extract("style-loader", "css-loader")
vs
loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'

@joshblack
Copy link

It would be the same pattern, except you would also pass the parameters into the css-loader part.

For example:

loader: ExtractTextPlugin.extract(
  'style',
  'css?modules&importLoaders=1&localIdentName=[hash:base64:5]&minimize',
)

@kurt-hardy
Copy link

I know this was awhile ago but I'm having problems with getting CSS module working with the ExtractTextPlugin. I have tried lots of things to no avail. Does anyone have a working example?

I have tried the following loaders
ExtractTextPlugin.extract("style", "css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]" ), "sass"

And
ExtractTextPlugin.extract("style"), "css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]", "sass"

Any help would be great :-)

Thanks
Kurtis

@janusch
Copy link

janusch commented Oct 31, 2016

@kurt-hardy the first syntax look right, not the second one.
What is it that is not working?

here one from here: https://github.com/react-toolbox/react-toolbox-example/blob/master/webpack.config.js

ExtractTextPlugin.extract('style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass')

@kurt-hardy
Copy link

@janusch thanks for your response.

I had ExtractTextPlugin(...), "sass". SASS being outside of the parenthesis for the plugin. Once I removed that it worked. I didn't realise that the second parameter was the loaders I wanted to run.

Thanks.
Kurtis

@janusch
Copy link

janusch commented Oct 31, 2016

Sassy sass loader! Glad you figured it out.
This loader chains can be so confusing. I am trying to get a config for webpack 2 working, no luck :(
PostCSS + cssnext wont transpile css variables, and I don't understand why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants