-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add new in-*
variant
#15025
Add new in-*
variant
#15025
Conversation
93af82b
to
a7feae7
Compare
|
||
// Replace `&` in target variant with `*`, so variants like `&:hover` | ||
// become `:where(*:hover) &`. The `*` will often be optimized away. | ||
node.selector = `:where(${node.selector.replaceAll('&', '*')}) &` |
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 basically the same implementation as the has-*
variant, but the selector is a bit different.
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.
Need to make sure suggestions work for in-*
cbff570
to
b189e55
Compare
Removed codemods for migrating group-[]:flex
until we handle prefixes
Co-authored-by: Eloy Espinaco <eloyesp@gmail.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Because this requires prefixing the `.group` if the prefix is configured.
b189e55
to
4508b79
Compare
This PR adds a new
in-*
variant that allows you to apply utilities when you are in a certain selector.While doing research for codemods, we notice that some people use
group-[]:flex
(yep, the arbitrary value is empty…). The idea behind is that people want to know if you are in a.group
or not.Similarly, some people use
group-[]/name:flex
to know when you are in a.group/name
class or not.This new
in-*
variant allows you to do that without any hacks.If you want to check whether you are inside of a
p
tag, then you can writein-[p]:flex
. If you want to check that you are inside of a.group
, you can writein-[.group]
.This variant is also a compound variant, which means that you can write
in-data-visible:flex
which generates the following CSS:This variant also compounds with
not-*
, for example:not-in-[.group]:flex
.Additionally, this PR also includes a codemod to convert
group-[]:flex
toin-[.group]:flex
.This was proposed before for v3 in #13912