Setup Tailwind in Vite
5 February 2023 (Updated 10 April 2023)
Install packages
npm install -D tailwindcss postcss autoprefixer prettier-plugin-tailwindcss
Setup Tailwind config
npx tailwindcss init -p
Set contents of tailwind.config.cjs
to:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Update index.css
@tailwind base;
@tailwind components;
@tailwind utilities;
Restart build process
npm run dev
Sources
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment