Next.js
-
Create a new Next.js app with
create-next-app
:npx create-next-app@latest next
-
Add Tailwind CSS to your Next.js app:
npm install tailwindcss@latest postcss@latest autoprefixer@latest
-
Initialize Tailwind CSS in your project:
npx tailwindcss init -p
-
Create a
styles/globals.css
file with the following content:@tailwind base; @tailwind components; @tailwind utilities;
-
Import the
globals.css
file in yourapp/layout.tsx
:import "../styles/globals.css" //...
-
Follow the main Setup guide to install
tailwindest
and generate yourtw.ts
file.
There you go! You have successfully set up Tailwind CSS in your Next.js app.