I setup a React project with Vite. I also installed TailwindCSS successfully with no errors in the terminal. I followed all documentation instructions but on trying to use the Tailwind classes from the doc examples, none are working. My final rendered HTML don't reflect the styles I have set on them.
vite.config.js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from "tailwindcss"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
css: {
postcss: {
plugins: [tailwindcss()],
}
}
})
tailwind.config.js
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{js, ts, jsx, tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
index.css
@itailwind components;
@tailwind utilities;
@tailwind base;
postcss.config.js
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Here's a repo containing the full project files: Tailwind Test