-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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 support for CSS modules #295
Add support for CSS modules #295
Conversation
|
||
[Css modules](https://github.com/css-modules/css-modules) are support by default for all files with `.module.(css|less|scss|sass)` extension. |
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.
Should be "CSS Modules" here plus in the header.
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.
Perhaps add examples of two css files where one (main.css) wouldn't use CSS Modules and another (my-awesome-component.module.css
) would be.
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.
By example, you mean to add example to gatsby-starter-default (or other starter) or to readme?
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.
Well that would be great too (adding to the starter) :-) but I meant here to add a simple example like:
// Uses CSS Modules
import './my-component.module.css'
// Doesn't use CSS Modules
import './main.css'
Looking great other than the few minor tweaks! |
@jakubrohleder if you have a bit of time soon to make the last few tweaks, that'd be great! |
@KyleAMathews I just have really busy time, but I'll finish this issue soon. Sorry for the delay. |
Great to hear! And no worries about being busy. I only asked as the remaining changes are simple enough that if you weren't able to get to it soon, I'd just tidy it up and release it myself. |
Looking great! Will merge and publish this soon. Could you merge the latest changes from master before then? |
@KyleAMathews I've just realised that css modules are important for Without them styles objects in the What a tricky PR... |
Hmmm you're right. Bit of a mind bender webpack eh? :-) |
Dunno if this helps, but for my component library to solve a similar problem I used: https://github.com/michalkvasnicak/babel-plugin-css-modules-transform |
Merged and added the css modules to the Added a css modules example to the default starter. See gatsbyjs/gatsby-starter-default@5e22fa2 and http://gatsbyjs.github.io/gatsby-starter-default/css-modules/ |
With this PR all
.module.(css|less|scss|sass)
files are treated as CSS modules.Resolves #193