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

Add CSS Module support. #1248

Merged
merged 5 commits into from
Feb 24, 2018
Merged

Conversation

tai2
Copy link
Contributor

@tai2 tai2 commented Feb 5, 2018

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.

@tai2 tai2 force-pushed the css-modules-by-suffix branch 2 times, most recently from d9ef2e6 to e82cb5e Compare February 5, 2018 07:28
const inlineCSSLoader = {
test,
use: [styleLoader].concat(extractOptions.use),
...modulesCondition
Copy link
Member

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

const extractCSSLoader = {
test,
use: ExtractTextPlugin.extract(extractOptions),
...modulesCondition
Copy link
Member

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).
Copy link
Member

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.

@tai2 tai2 force-pushed the css-modules-by-suffix branch from d3d6561 to 2021330 Compare February 9, 2018 14:28
@tai2
Copy link
Contributor Author

tai2 commented Feb 12, 2018

Fixed

@gauravtiwari
Copy link
Member

thanks @tai2 Will take a look at this soon.

@gauravtiwari gauravtiwari merged commit 88ff79c into rails:master Feb 24, 2018
@gauravtiwari
Copy link
Member

thanks @tai2 for this 🍰 💯

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

Successfully merging this pull request may close these issues.

2 participants