Skip to content

How to add Tailwind to react js project #791

Answered by Sengwamana
Uwase-Sonia asked this question in Q&A
Discussion options

You must be logged in to vote

To add Tailwind CSS to a React.js project, you'll need to install Tailwind and configure it properly. Below are all the necessary steps, whether you're using Create React App (CRA) or Vite.

✅ Requirements
Node.js (v12.13+)

A working React project (CRA or Vite)

npm or yarn

🛠️ Steps to Add Tailwind CSS to a React Project
✅ 1. Create or Use a React Project
If you don't already have one:

npx create-react-app my-app
cd my-app
Skip this if you already have a React project.

✅ 2. Install Tailwind CSS and its dependencies
Run the following command:

npm install -D tailwindcss postcss autoprefixer
Then generate the config files:

npx tailwindcss init -p
This creates two files:

tailwind.config.js

post…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Uwase-Sonia
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy