-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
What version of Tailwind CSS are you using?
v4.0.14 (the latest released version, at the time of writing)
What build tool (or framework if it abstracts the build tool) are you using?
Vite 6.2.2, Vue 3.5.13, Pug 3.0.3 (the latest released version of each, at the time of writing)
What version of Node.js are you using?
v22.14.0 (the latest LTS release, at the time of writing)
What browser are you using?
Firefox (though I don't think it's relevant)
What operating system are you using?
Linux (Debian / MX Linux) (though I don't think it's relevant)
Reproduction URL
I cannot provide a Tailwind Play URL, because I think that this bug occurs only in Pug templates, whereas Tailwind Play only supports plain HTML.
But here's a public GitHub repo with a minimal reproduction: https://github.com/davidrunger/tailwind-pug-bug-demo
And here's that GitHub repo imported into CodeSandbox: https://codesandbox.io/p/github/davidrunger/tailwind-pug-bug-demo/main?file=%2Fsrc%2FApp.vue
Describe your issue
CSS styles are sometimes not included for some Tailwind classes in Pug templates in my Vue project.
In the reproduction linked above, there is this Vue component:
<template lang="pug">
.bg-neutral-900.text-red-500 This is a test.
</template>
When viewed in the browser, only the text-red-500
class has any visible effect (making the text red). The bg-neutral-900
class does not have any effect (when served either via the Vite hot-reloading dev server or when compiled and viewed via the Vite static production preview server).
Live dev server:
Compiled production server:
I expect that the bg-neutral-900
class in the Pug Vue template would cause Tailwind to include CSS that gives that text a dark background, which is what happens if we go back to tailwindcss
and @tailwindcss/vite
at v4.0.9 :
Live dev server:
Compiled production server:
Thank you for Tailwind and for taking a look at this bug!
Edit: The bug also occurs when using the Tailwind PostCSS plugin, rather than the Tailwind Vite plugin (when using Tailwind v4.0.14, and not when using Tailwind v4.0.9). I pushed a branch use-tailwind-postcss-plugin
to the minimal bug reproduction repo that demonstrates this.