Description
What version of Tailwind CSS are you using?
4.0.1
What build tool (or framework if it abstracts the build tool) are you using?
vite
What version of Node.js are you using?
22.13.1
What browser are you using?
Firefox
What operating system are you using?
Ubuntu 24.04.1
Describe your issue
With Tailwind 3.4.x I can incorporate Tailwind classes in my Vitepress markdown files. My tailwind.config.js looks like this
export default {
content: [
'./src/**/*.{vue,js,html}',
'./docs/**/*.md',
'./index.html'
],
theme: { ... }
One of the markdown files contains a
<div class="bg-amber-900">
and Vite delivers a stylesheet containing
.bg-amber-900 {
--tw-bg-opacity: 1;
background-color: rgb(120 53 15 / var(--tw-bg-opacity, 1));
}
When switching to Tailwind 4 the config file is gone.
Since the .vitepress directory and all its contents is not in a .gitignore all the markdown files should be parsed.
The CSS now looks like this
@import 'tailwindcss';
@theme { ... }
but the resulting CSS provided by Vite does not contain a .bg-amber-900
class.
Adding
@source './docs/**/*.md';
doesn't change anything - the resulting CSS provided by Vite does not contain a .bg-amber-900
class.
package.json
"dependencies": {
"tailwindcss": "^4.0.1",
"vite": "^6.0.11",
"@tailwindcss/vite": "^4.0.1",
"vitepress": "^1.6.3"
...
},
vite.config.js
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
...
plugins: [
tailwindcss(),
],
})
Expected behavior:
Tailwind 4.0 should also generate stylesheets containing classes used in Vitepress markdown files.