Skip to content

docs: update Tailwind CSS setup guide for v4 (2025) with legacy v3 support. #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Video 98/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="src/output.css">
<link rel="stylesheet" href="output.css">
</head>
<body>

Expand Down
1 change: 1 addition & 0 deletions Video 98/input.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "tailwindcss";
6 changes: 4 additions & 2 deletions Video 98/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npx tailwindcss -i ./src/input.css -o ./src/output.css --watch"
"build": "npx tailwindcss -i ./input.css -o ./output.css --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"tailwindcss": "^3.4.1"
"tailwindcss": "^4.0.0",
"postcss": "^8.4.0",
"autoprefixer": "^10.4.0"
}
}
46 changes: 45 additions & 1 deletion Video 98/setup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
## How to setup Tailwind CSS

> **Note:** These instructions have been updated for Tailwind CSS v4 (2024). If you are following the original course (which used v3), see the legacy instructions below. This update was made because I was following the course and hit issues due to outdated steps, so I am submitting this fix to help future learners!

---

### 🟢 **Tailwind CSS v4 (Recommended, 2024)**

**Step 1:** Install Tailwind CSS CLI, PostCSS, and Autoprefixer:

```
npm install -D tailwindcss@latest tailwindcss/cli postcss autoprefixer
```

**Step 2:** Create an `input.css` file in your project root (not in `src/`):

```
@import "tailwindcss";
```

**Step 3:** Add this build script to your `package.json`:

```
"build": "npx tailwindcss -i ./input.css -o ./output.css --watch"
```

**Step 4:** Run the build script:

```
npm run build
```

**Step 5:** Link the generated `output.css` in your HTML (in the root, not in `src/`):

```html
<link rel="stylesheet" href="output.css">
```

---

### 🟡 **Legacy Tailwind CSS v3 Setup (as in the original course)**

Step 1: Run the following commands

```
Expand All @@ -24,4 +64,8 @@ Step 4: Include the src/output.css file to your html
Step 5: Run the following command:
```
npx tailwindcss -i ./src/input.css -o ./src/output.css --watch
```
```

---

**If you are starting fresh, use the v4 method above for a simpler and more up-to-date experience!**
3 changes: 0 additions & 3 deletions Video 98/src/input.css

This file was deleted.

Loading