-
-
Notifications
You must be signed in to change notification settings - Fork 778
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
feat(preset-wind): add important
option
#3484
Conversation
✅ Deploy Preview for unocss ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
return { | ||
...presetMini(options), | ||
name: '@unocss/preset-wind', | ||
theme, | ||
rules, | ||
shortcuts, | ||
variants: variants(options), | ||
postprocess: postprocessors(options), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it would be better to update the variant directly instead of relying on postprocess, which will affect all !important
even if it's the user's explicit rule that does not come from the important variant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get your point. if you mean it's better to change important:xxx
variant, then it's another story. The purpose of this PR is as I described in #3474, which should and will apply to all rules (and that's what Tailwind's important
global option does too). It will help users fight against those UI library's styles with higher specificity, globally.
Overall, I don't think changing the important:xxx
variant is a good idea since essentially user will sometimes need to write the real !important
. Changing its behavior makes no sense.
For your partially opt-in idea, I have a better (at least from my perspective) solution described in #3474 (comment), please welcome to have a look and leave your comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see. I thought it was the configuration for the important variant, but actually not. Making sense then, I think we should mention that this would affect all rules. Or maybe it's worth to have a dedicated preset for more explicit awareness and compsables with other rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tailwind's functionality so I think it makes sense to include it in preset-wind. But it's up to you anyway.
If you want to proceed with that, I'll add a warning block to the doc. Otherwise you can close this and I don't mind to put it into my own preset for my own usages.
By the way what do you think about my (ancestor-xxx:
variant idea #3474 (comment)? it could be a potential solution for this.scope-x:
) is already doing such thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the implementation for #3474
Regarding the usage of
:is()
selector, please read tailwindlabs/tailwindcss#10835