Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mdasifmunshe/90142bfba181e3deb00642301e558c7a to your computer and use it in GitHub Desktop.
Save mdasifmunshe/90142bfba181e3deb00642301e558c7a to your computer and use it in GitHub Desktop.
Setting up Tailwind CSS in a Vite project with Yarn.
/*
As mentioned by @samuel-jarvis this gist no longer works with Tailwind CSS v4.
But it will still work for Tailwind CSS v3.4.17 and below
*/
/* Terminal */
yarn create vite my-project
cd my-project
yarn add -D tailwindcss postcss autoprefixer
yarn tailwindcss init -p
/* tailwind.config.cjs */
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
/* index.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
/* Terminal */
yarn dev
/* Enjoy */
@samuel-jarvis
Copy link

Hello @mdasifmunshe Due to the recent update to tailwind css 4. this setup can no longer work

@mdasifmunshe
Copy link
Author

mdasifmunshe commented Feb 26, 2025

Dear @samuel-jarvis Thank you for bringing my attention to this matter. I have already updated this gist and opening a new gist for Tailwind CSS v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment