-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
vite build
produces incorrectly flattened nested CSS
#18974
Comments
vite build
produces incorrectly flattened nested CSS
Hello! Any news on this issue ? I have the same issue using some tailwind classes on Nuxt. |
I +1, Got the same issue here, this CSS from tailwind 4 (beta > 6) is not applied in our nuxt build (3.15.1)
became
The beta version of tailwind 4 is not buildable with vite as a result (or I don't know how) |
I've moved my Sveltekit project to Tailwind v4 with Vite yesterday and there I have a @utility scrollbar-hidden {
/* Hide scrollbar for Chrome, Safari and Opera */
&::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
} This shows up and works in my local dev build using import { defineConfig } from 'vitest/config'
import { sveltekit } from '@sveltejs/kit/vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
build: { target: 'ESNext' },
plugins: [sveltekit(), tailwindcss()],
test: {
include: ['tests/vitest/**/*.{test,spec}.{js,ts}']
}
}) I'm currently on those package versions:
|
Has anyone resolved this issue? |
same here! .space-x-4 {
:where(& > :not(:last-child)) {
--tw-space-x-reverse: 0;
margin-inline-start: calc(calc(var(--spacing) * 4) * var(--tw-space-x-reverse));
margin-inline-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)));
} final code: .space-x-4 :where(>:not(:last-child)) {
--tw-space-x-reverse: 0;
margin-inline-start: calc(calc(var(--spacing) * 4) * var(--tw-space-x-reverse));
margin-inline-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)))
} |
Describe the bug
When using modern CSS with nesting, a production build will generate invalid CSS.
Given the following CSS:
In a production build, this is flattened as:
This CSS is invalid because
:where(…)
doesn't accept relative selectors.But I expect it to be flattened as this instead:
Note: in dev mode (
vite dev
) it works as expected.Reproduction
https://github.com/RobinMalfait/vite-incorrect-css-flattening
Steps to reproduce
npm install
npm run dev
— open http://localhost:5173, the text should be rednpm run build
— open http://localhost:4173, the text should be red, but is blackSystem Info
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: