Introduction of disabling/ignoring variants #18895
rozsazoltan
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR: New
@disable-variant
or@ignore-variant
directive.Problem
Currently, there's no proper way to revoke built-in variants. For example, a
light:
variant provided by an external plugin cannot be ignored, so the styles it introduces become part of theoutput.css
, even if I try to make the variant rule ignored using@custom-variant
, e.g.,:not(*)
.The same issue occurs with the built-in
dark
variant if I personally don't need it. For instance, I might want to ship the smallest possible CSS, so I don't need a separate dark mode. Even if I don't use thedark:
variant myself, UI packages do, which means dark variant references end up in theoutput.css
- even if I manually disable the dark variant.input.css
index.html
And
output.css
will not ignoredark:bg-black
; it will be included inoutput.css
even though I don't want it.Idea
There should be an option, either inside
@custom-variant
, to disable specific variants.Or a directive like
@disable-variant
(or maybe@ignore-variant
?), which, regardless of any previous instructions, permanently prevents any styles associated with that variant from being included in theoutput.css
if it appears even once.input.css
index.html
And
output.css
would only include bg-white; thedark:bg-black
is ignored due to the disable.Beta Was this translation helpful? Give feedback.
All reactions