Skip to content

officialapnadesign/tailwindcss-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Tailwind CSS v4 Setup Guide

A complete step-by-step guide to install, connect, and use Tailwind CSS v4 using the official Tailwind CLI.


πŸ“‹ Prerequisites

Before getting started, make sure you have:

  • βœ… Node.js installed
  • βœ… npm installed
  • βœ… VS Code (Recommended)

Check your installed versions:

node -v
npm -v

πŸ“¦ Step 1: Install Tailwind CSS v4

Install Tailwind CSS and the official CLI package:

πŸ“Œ This is the command that adds Tailwind CSS to your project.

npm install tailwindcss @tailwindcss/cli

🎨 Step 2: Create the Input CSS File

Create a file named:

input.css

Inside the file, add:

@import "tailwindcss";

What does this do?

This imports all Tailwind utilities, components, and core styles into your project.


βš™οΈ Step 3: Generate the Output CSS File

Compile Tailwind CSS into a usable CSS file:

npx @tailwindcss/cli -i ./input.css -o ./output.css

Understanding the command

Option Description
-i Input CSS file
-o Output CSS file

This command:

πŸ“₯ Reads from:

input.css

πŸ“€ Generates:

output.css

πŸ”„ Step 4: Enable Watch Mode (Recommended)

Automatically rebuild CSS whenever you save changes.

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

Why use Watch Mode?

βœ… No need to run the build command repeatedly

βœ… CSS updates automatically

βœ… Faster development workflow

Keep this terminal running while developing.


πŸ”— Step 5: Connect Tailwind CSS to HTML

Link the generated CSS file inside your HTML document.

<link rel="stylesheet" href="./output.css">

Example:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="./output.css">
</head>
<body>

  <h1 class="text-4xl font-bold text-cyan-500">
    Hello Tailwind CSS πŸš€
  </h1>

</body>
</html>

πŸ§ͺ Step 6: Test the Installation

Add the following code:

<h1 class="text-4xl font-bold text-cyan-500">
  Tailwind is Working! πŸš€
</h1>

Expected Result

βœ… Large text

βœ… Cyan color

βœ… Tailwind classes applied

If everything looks correct, Tailwind is connected successfully.


πŸ“ Recommended Folder Structure

project/
β”‚
β”œβ”€β”€ index.html
β”œβ”€β”€ input.css
β”œβ”€β”€ output.css
β”œβ”€β”€ package.json
β”œβ”€β”€ package-lock.json
β”‚
└── assets/
    β”œβ”€β”€ images/
    └── icons/

πŸ›  Development Workflow

1️⃣ Install Tailwind

npm install tailwindcss @tailwindcss/cli

2️⃣ Create Input File

@import "tailwindcss";

3️⃣ Start Watch Mode

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

4️⃣ Connect CSS

<link rel="stylesheet" href="./output.css">

5️⃣ Start Building

Use Tailwind utility classes directly in your HTML.


⚑ Useful Commands

πŸ“¦ Install Tailwind CSS

npm install tailwindcss @tailwindcss/cli

πŸ— Build CSS Once

npx @tailwindcss/cli -i ./input.css -o ./output.css

πŸ‘€ Watch Mode

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

βœ… Setup Checklist

  • Node.js Installed
  • npm Installed
  • Tailwind CSS Installed
  • input.css Created
  • @import "tailwindcss" Added
  • output.css Generated
  • HTML Connected to output.css
  • Watch Mode Running
  • Tailwind Classes Working

πŸŽ‰ Congratulations!

Your Tailwind CSS v4 environment is now fully configured and ready for development.

Build fast, create beautiful interfaces, and enjoy the power of utility-first CSS. πŸš€βœ¨


πŸ‘¨β€πŸ’» Author

Monty Yadav

  • πŸ’» Web Design & Development
  • 🎨 Canva β€’ AI β€’ Creativity
  • πŸš€ Building in Public
  • 🎬 Content β€’ Branding β€’ Editing

Helping small businesses build their online presence through design, websites, content, and AI.


⭐ If you found this repository helpful, consider giving it a star.

Made with ❀️ by Monty Yadav

About

A complete step-by-step guide to install, connect, and use Tailwind CSS v4 using the official Tailwind CLI.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors