rsnext/examples/with-tailwindcss
Joe Haddad 18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
..
components Improve linting rules to catch more errors (#9374) 2019-11-10 19:24:53 -08:00
pages Improve linting rules to catch more errors (#9374) 2019-11-10 19:24:53 -08:00
styles Add Purgecss to with-tailwindcss example (#9145) 2019-10-22 22:53:33 -04:00
next.config.js Refactor with tailwindcss example to use next-css (#5461) 2018-11-08 14:42:55 +01:00
package.json Fix with-tailwindcss build issues (#9179) 2019-10-23 11:06:33 -04:00
postcss.config.js Improve linting rules to catch more errors (#9374) 2019-11-10 19:24:53 -08:00
README.md Fix Prettier Commit Hook (#9245) 2019-10-30 12:35:51 +01:00

Tailwind CSS example

This is an example of using Tailwind CSS in a Next.js project.

How to use

Using create-next-app

Execute create-next-app with Yarn or npx 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 manually

Download the example:

curl https://codeload.github.com/zeit/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 now (download)

now

The idea behind the example

This setup is a basic starting point for using Tailwind CSS with Next.js. This example also includes the following PostCSS plugins:

Limitations

Dynamically generated class strings will be purged

Purgecss takes a very straightforward approach to removing unused CSS. It simply searches an entire file for a string that matches a regular expression. As a result, class strings that are dynamically created in a template using string concatenation will be considered unused and removed from your stylesheet. Tailwind CSS addresses this problem in more detail in their documentation.