Create a Next.js App with Tailwind CSS
Shen Lu
Posted on Jan 12, 2023
views
1 min read (160 words)
Create a new Next.js project with TypeScript and ESlint:
Install tailwindcss and its peer dependencies via pnpm
,
and then run the init command to generate both tailwind.config.js
and postcss.config.js
.
Add the paths to all of your template files in your tailwind.config.js file.
Add the @tailwind
directives for each Tailwind’s layers to your globals.css
file.
Run pnpm dev
to start the development server,
Visit http://localhost:3000 to view your application.