-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add CSS Module support. #1248
Add CSS Module support. #1248
Conversation
d9ef2e6
to
e82cb5e
Compare
package/rules/style_rule_factory.js
Outdated
const inlineCSSLoader = { | ||
test, | ||
use: [styleLoader].concat(extractOptions.use), | ||
...modulesCondition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will probably need to use Object.assign here since object spread isn't supported in 6.x: http://node.green/#ES2018-features-object-rest-spread-properties-object-rest-properties
package/rules/style_rule_factory.js
Outdated
const extractCSSLoader = { | ||
test, | ||
use: ExtractTextPlugin.extract(extractOptions), | ||
...modulesCondition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/css.md
Outdated
@@ -6,10 +6,12 @@ Webpacker supports importing CSS, Sass and SCSS files directly into your JavaScr | |||
|
|||
## Import styles into your JS app | |||
|
|||
Stylesheets end with '.modules.*' is treated as [CSS Modules](https://github.com/css-modules/css-modules). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we please make a new documentation for this? We still support regular sass or css imports without css modules.
d3d6561
to
2021330
Compare
Fixed |
thanks @tai2 Will take a look at this soon. |
thanks @tai2 for this 🍰 💯 |
Taken from: rails/webpacker#1248
Treat some file names like
.module.css
as CSS Modules.This naming convention is adopted by some other OSSs such create-react-app or poi.