Install Tailwind CSS with Vite - Tailwind CSS
Create your project
**npm create vite@latest my-project -- --template react
cd my-project**
Install Tailwind CSS
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
Configure your template paths in tailwind.config.js
File
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Add the Tailwind directives to your CSS to index.css
file
@tailwind base;
@tailwind components;
@tailwind utilities;
Start your build process
npm run dev
Start using Tailwind in your project in App.jsx
export default function App() {
return (
<h1 className="text-3xl text-blue-900 font-bold underline ">
Hello world!
</h1>
)
}
Last Updated : January 27, 2024