Replies: 3 comments 2 replies
-
And this might also have consequences for dark mode. I see I expect people would be unable to use dark mode if they are using a selector in |
Beta Was this translation helpful? Give feedback.
-
Here's a quick hack I am using for now to make variants respect options like Not sure if it's okay/good enough to open a PR though. But happy too. |
Beta Was this translation helpful? Give feedback.
-
You could use addVariant('iframe', '&:is(.inside-iframe *)'); Would result in: html body .tw .iframe\:py-2:is(.inside-iframe *) { |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We use tailwind with
important: 'html body .tw'
(because we are migrating away from a different framework).One use case we have is styling things based on a class set on the html/body.
Variants are a perfect solution for this but there's no way to create a variant without the important selector getting prefixed.
.inside-iframe
to thehtml
element when the current page is inside an iframe.iframe
that'd ideally generate classes like.inside-iframe .iframe:py-2 {.......}
and we'd use it like<div class='py-8 iframe:py-2'>
.However, currently this seems impossible, as tailwind always generates classes with the important selector prefix (i.e
html body .tw .inside-iframe iframe:py-2 {........}
Not sure if I am missing something here, but I've glanced at the tailwind documentation & source code and I don't seem to find a way.
Beta Was this translation helpful? Give feedback.
All reactions