Skip to content

Tailwind classes do not compile as expected when using CSS-Modules and :dark prefix #3204

Answered by adamwathan
trm217 asked this question in Help
Discussion options

You must be logged in to vote

Yeah nothing we can really do about this on our end I'm afraid — CSS modules will automatically scope all CSS inside of it like you're seeing. Whatever solution you come up with here will probably be outside of the scope of Tailwind itself. I don't know how you can write a partially global/partically scoped selector with CSS modules in general, like if you wrote this by hand:

.informationName {
    font-weight: 900;
    color: #000;
}
.dark .informationName {
  color: #fff;
}

...the .dark class would still get mangled by CSS modules right? So I'm not sure if CSS modules is even compatible with the concept of a distant parent class modifier like this.

No plans to do anything in Tailwind to…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
7 replies
@trm217
Comment options

@trm217
Comment options

@rikusen0335
Comment options

@trm217
Comment options

@rikusen0335
Comment options

Answer selected by trm217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #3204 on December 27, 2020 21:48.