-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Bug: vite warnings when minifying css - Empty :where() generated #16582
Comments
Would you be able to provide a reproduction please? Edit: was able to replicate it with: @reference "tailwindcsst/theme.css";
@custom-variant dark (&:where(.dark, .dark *));
body::-webkit-scrollbar {
@apply bg-zinc-100 dark:bg-zinc-800;
} Using Vite as well as the CLI: body::-webkit-scrollbar{background-color:var(--color-zinc-100)}body::-webkit-scrollbar:where(){background-color:var(--color-zinc-800)} Edit: Seems to work fine in Lightning CSS Playground but it does not have the Indeed, editing the CLI code to bypass body::-webkit-scrollbar {
background-color: var(--color-zinc-100);
&:where(.dark, .dark *) {
background-color: var(--color-zinc-800);
}
} It seems like it is a Lightning CSS bug. |
Facing the same issue using .p-autocomplete-input-chip input::placeholder {
@apply text-surface-500 dark:text-surface-400
} when minified .p-autocomplete-input-chip input::-moz-placeholder:where(){color:color-mix(in srgb,var(--p-surface-400)100%,transparent)}.p-autocomplete-input-chip input::placeholder:where(){color:color-mix(in srgb,var(--p-surface-400)100%,transparent)} same issue for other transforming (254) assets/styles/tailwind.css
WARN warnings when minifying css: 11:09:43 PM
▲ [WARNING] Unexpected ")" [css-syntax-error]
<stdin>:1:38439:
1 │ ...p input::-moz-placeholder:where(){color:color-mix(in srgb,var(--...
╵ ^
▲ [WARNING] Unexpected ")" [css-syntax-error]
<stdin>:1:38555:
1 │ ...t-chip input::placeholder:where(){color:color-mix(in srgb,var(--...
╵ ^
▲ [WARNING] Unexpected ")" [css-syntax-error]
<stdin>:1:159866:
1 │ ...gglebutton-checked:before:where(){background-color:color-mix(in ...
╵ ^
▲ [WARNING] Unexpected ")" [css-syntax-error]
<stdin>:1:263060:
1 │ ...onfirmpopup-flipped:after:where(){border-top-color:color-mix(in ...
╵ ^
▲ [WARNING] Unexpected ")" [css-syntax-error]
<stdin>:1:263302:
1 │ ...nfirmpopup-flipped:before:where(){border-top-color:color-mix(in ...
╵ ^
▲ [WARNING] Unexpected ")" [css-syntax-error]
<stdin>:1:269485:
1 │ ...r.p-popover-flipped:after:where(){border-top-color:color-mix(in ...
╵ ^
▲ [WARNING] Unexpected ")" [css-syntax-error]
<stdin>:1:269737:
1 │ ....p-popover-flipped:before:where(){border-top-color:color-mix(in ...
╵ ^ |
Upon further digging I believe this happens because the If we were to use @reference "tailwindcsst/theme.css";
@custom-variant dark (&:where(.dark, .dark *));
foo::before {
@apply text-black dark:text-white;
} Would compile to: foo::before {
color: var(--color-black);
&:where(.dark, .dark *) {
color: var(--color-white);
}
} Which in itself is like: foo::before {
color: var(--color-black);
}
foo::before:where(.dark, .dark *) {
color: var(--color-white);
} That second rule is invalid - As an aside, Adam Wathan (creator of Tailwind) does seem to advocate avoiding
So consider trying to leverage your templating system instead of writing any CSS at all. Otherwise, you could write the above as: foo {
&::before {
color: var(--color-black);
}
@variant dark {
&::before {
color: var(--color-white);
}
}
} |
Thanks @wongjn for all the effort! |
The code in question:
The error on bundling:
General detail
I am stumped, as I am getting weird behaviours on CSS minification.
In digging deeper it seems that it generates an empty
where()
when it should generate none.It is only on build, and it is valid CSS that gets altered. Details are added below.
I also found the same recently reported behaviour in the
daisyui
repo. It seems they are struggling with an empty:is()
being generated. It is a consistent pattern, as I do not usedaisyui
, but both our projects include Tailwind 4, and same type of issue.Link for reference.
saadeghi/daisyui#3453
Happy to provide more data as needed, to make lives easier for devs and anyone else with the issue.
What version of TailwindCSS are you using?
Project detail
Command / IDE
The text was updated successfully, but these errors were encountered: