This is an example of using Tailwind CSS in a Next.js project.
Deploy the example using Vercel:
Execute create-next-app
with npm or Yarn to bootstrap the example:
npx create-next-app --example with-tailwindcss with-tailwindcss-app
# or
yarn create next-app --example with-tailwindcss with-tailwindcss-app
Download the example:
curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-tailwindcss
cd with-tailwindcss
Install it and run:
npm install
npm run dev
# or
yarn
yarn dev
Deploy it to the cloud with Vercel (Documentation).
This example is a basic starting point for using Tailwind CSS with Next.js. It includes the following PostCSS plugins:
- postcss-preset-env - Adds stage 2+ features and autoprefixes
To control the generated stylesheet's filesize, this example uses Tailwind CSS' purge
option to remove unused CSS.