// TAILWIND.SETUP
HTML + Tailwind CSS + JavaScript

Ship your first
Tailwind build.

A practical, no-fuss setup for Tailwind CSS v4. Install the tools, wire up the CLI, and get a live rebuild loop running in minutes.

01

Prerequisite

Install Node.js & npm

1–2 min

npm ships with Node.js, so install Node once and verify both commands work in your terminal.

Using Homebrew
brew install node

Restart your terminal if you installed Node on Windows, then check:

node -v npm -v
02

Initialize

Create your project

Make a project folder, initialize package.json, and create the source and output directories.

macOS / Linux
mkdir "Modern Website"
cd "Modern Website"
npm init -y
mkdir src dist
touch src/index.html src/input.css src/script.js
Windows PowerShell
mkdir "Modern Website"
cd "Modern Website"
npm init -y
mkdir src
mkdir dist
New-Item src/index.html -ItemType File
New-Item src/input.css -ItemType File
New-Item src/script.js -ItemType File
03

Install

Add Tailwind CSS v4

From inside the project folder, install Tailwind and its CLI. Tailwind v4 uses a CSS-first setup, so no tailwind.config.js is required.

Terminal

npm install tailwindcss @tailwindcss/cli
04

Wire it up

Add CSS, start the CLI, connect HTML

Three small connections finish the setup: import Tailwind, run the watcher, and link the compiled stylesheet.

A

Add the Tailwind import

In src/input.css:

@import "tailwindcss";
B

Start the Tailwind watcher

Keep this terminal running while you work.

npx @tailwindcss/cli -i ./src/input.css -o ./dist/output.css --watch
C

Link the output in HTML

Add this inside src/index.html:

Test it with:

<h1 class="text-3xl font-bold underline">Hello World!</h1>

Keep nearby

Quick reference

0 / 4 complete

Check versions

node -v
npm -v

Stop Tailwind

Ctrl + C

Project structure

Modern Website/
├── 📁 dist/
│   └── output.css          ← compiled by Tailwind (don't edit)
├── 📁 src/
│   ├── index.html          ← your page
│   ├── input.css           ← @import "tailwindcss" lives here
│   └── script.js
├── package.json
└── package-lock.json

VS Code tip: install Tailwind CSS IntelliSense. If the editor flags @theme, set CSS › Lint: Unknown At Rules to Ignore.

Copied to clipboard