Ignore classes via. NextJS Module CSS
Answered
Japanese pilchard posted this in #help-forum
Japanese pilchardOP
Is it possible to ignore certain classes in the NextJS Module CSS?
I have to ignore the
I have to ignore the
.dark property.Answered by Rose-breasted Grosbeak
See the first suggestion,
https://chatgpt.com/share/67946981-05a0-8011-83d7-8f9585d385a2
It probably wouldn't work in normal css modules (it didn't work for me, the last time I tried)
So much for AGI..
https://chatgpt.com/share/67946981-05a0-8011-83d7-8f9585d385a2
It probably wouldn't work in normal css modules (it didn't work for me, the last time I tried)
So much for AGI..
10 Replies
Rose-breasted Grosbeak
Wdym by ignore?
@Rose-breasted Grosbeak Wdym by ignore?
Japanese pilchardOP
The current problem is that the parsed CSS looks like this:
But it should look like this:
This is important so that Tailwind V4 works completely with the ModuleCSS. And for this I would have to ignore the .dark properties somehow so that they are not parsed
Related to https://github.com/tailwindlabs/tailwindcss/issues/15814
.page-module__E0kJGG__description:where(.page-module__E0kJGG__dark, .page-module__E0kJGG__dark *) {
color: var(--color-red-500);
}But it should look like this:
.page-module__E0kJGG__description:where(.dark, .dark *) {
color: var(--color-red-500);
}This is important so that Tailwind V4 works completely with the ModuleCSS. And for this I would have to ignore the .dark properties somehow so that they are not parsed
Related to https://github.com/tailwindlabs/tailwindcss/issues/15814
Japanese pilchardOP
Push
@Japanese pilchard The current problem is that the parsed CSS looks like this:
css
.page-module__E0kJGG__description:where(.page-module__E0kJGG__dark, .page-module__E0kJGG__dark *) {
color: var(--color-red-500);
}
But it should look like this:
css
.page-module__E0kJGG__description:where(.dark, .dark *) {
color: var(--color-red-500);
}
This is important so that Tailwind V4 works completely with the ModuleCSS. And for this I would have to ignore the .dark properties somehow so that they are not parsed
Related to https://github.com/tailwindlabs/tailwindcss/issues/15814
Rose-breasted Grosbeak
Oh this issue.
I don't think it's possible in normal modules. I just added the selectors in the global css file, otherwise, checkout scss.
I don't think it's possible in normal modules. I just added the selectors in the global css file, otherwise, checkout scss.
sass, whatever
Rose-breasted Grosbeak
See the first suggestion,
https://chatgpt.com/share/67946981-05a0-8011-83d7-8f9585d385a2
It probably wouldn't work in normal css modules (it didn't work for me, the last time I tried)
So much for AGI..
https://chatgpt.com/share/67946981-05a0-8011-83d7-8f9585d385a2
It probably wouldn't work in normal css modules (it didn't work for me, the last time I tried)
So much for AGI..
Answer
@Rose-breasted Grosbeak Oh this issue.
I don't think it's possible in normal modules. I just added the selectors in the global css file, otherwise, checkout scss.
Japanese pilchardOP
I got it to work with the following code:
:global(.dark) .cool_text {
@apply text-red-500;
}The global tag means that the .dark is not parsed. It is a bit annoying this way, but I accept it
Japanese pilchardOP
I found out last night, but forgot to tell you here. Thanks for your help
Rose-breasted Grosbeak
something to consider about turbopack
https://nextjs.org/docs/app/api-reference/turbopack#unsupported-features
https://nextjs.org/docs/app/api-reference/turbopack#unsupported-features