You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A utility's nested rule under a pseudo-element variant is written as ::selection > * and dropped with a warning #20571
used under a pseudo-element variant, such as selection:bg-red-500 (also backdrop:, before:, after:, marker:), makes the build print:
Found 1 warning while optimizing generated CSS:
Issue #1:
.selection\:bg-red-500 ::selection > * {
^-- Pseudo-elements like '::before' or '::after' can't be followed by selectors like 'Delim('>')'
The variant is applied to every nested rule of the matched utility. The nesting is then flattened by pasting the parent selector in for &, which gives .x::selection > *. Under CSS Nesting, & cannot represent a pseudo-element, so that rule matches nothing and could be dropped quietly. Today lightningcss drops it with the warning above. For before:/after: the rule is dropped silently and an empty .after\:bg-white:after{content:var(--tw-content)} remains. For marker: the output keeps ::-webkit-details-marker>* with no warning.
A utility cannot opt out on its side: it never sees which variants the class carries, and @variant inside it cannot name a negated pseudo-element variant.
Expected: a nested rule whose parent selector ends in a pseudo-element is dropped while flattening, with no warning, as Tailwind already does silently for its own selection:space-x-4 (which ships a dead :where() rule).
Activity
Drop nested rules that put a combinator after a pseudo-element
Drop nested rules that put a combinator after a pseudo-element (tailw…