-
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
Support CSS Modules #193
Comments
I love CSS Modules! |
Hi! That's an awesome idea. I managed to make css modules work (tested for
If you find it worth adding to the gatsby webpack config I can create an appropriate PR |
@jakubrohleder so the reason I didn't add support for them is isn't turning on CSS Modules an all-or-nothing decision? Once they're enabled you have to use them? Or does the css module transformation only happen if you import a css file? Assuming it is a binary choice, we need to wait until Gatsby has a plugin system w/ the ability to configure the css plugin. |
@KyleAMathews you are totally right, this change isn't backward compatible (at least according to my knowledge). It is possible thought to use global classes in modules (their names are not processed):
or enable css module processing only for certain extensions (it's not standard, but why not As you said: this change can wait for some time, nevertheless this snippet will help those who desire this kind of functionality. |
That's what I do too, by enabling |
@markdalgleish what do you suggest? |
I think targeting |
The convention ive seen actually has been the opposite, using |
@NogsMPLS some of the packages on npm can require CSS from JS: |
Sorry on phone, i mean filename. EDIT: My comment was just in answer to Kyle's 'convention' question. Just wanted to chime in and say I've seen and also used |
Thanks @markdalgleish! I think *.module is safest. There'll be a lot of people using Gatsby who don't know what CSS Modules are so it's better that modules are opt-in vs. opt-out if we're going to turn them on for everyone. |
If someone wants to work on a PR for this, let us know and I'll assign it to you. |
Great discussion here! Enabling css modules for |
@jakubrohleder thanks! 💯 Looking forward to your PR. |
Oh weird, I can't assign you I guess unless you're a team member of Gatsbyjs. So I just added you and will assign you once you accept :-) |
CSS Modules are cool. Gatsby should ship with support for them as well as demonstrate how to use them in official starters.
The text was updated successfully, but these errors were encountered: