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.cssfile with the following content:@tailwind base; @tailwind components; @tailwind utilities; -
Import the
globals.cssfile in yourapp/layout.tsx:import "../styles/globals.css" //... -
Follow the main Setup guide to install
tailwindestand generate yourtw.tsfile.
There you go! You have successfully set up Tailwind CSS in your Next.js app.