Tailwind CSS
Tailwind CSS is a utility-first CSS framework for rapidly building custom user interfaces. This guide will show you how to get started with Gatsby and Tailwind CSS.
Installing and configuring Tailwind
Please follow the official “Install Tailwind CSS with Gatsby” guide to install and configure Tailwind CSS with Gatsby. Some important notes when configuring Tailwind with Gatsby:
- It is not recommended that you include Gatsby’s output directories (
public
and.cache
) in yourcontent
array in yourtailwind.config.js
. You should only include your source files to have Tailwind working as expected. - If you use GraphQL Typegen a file at
src/gatsby-types.d.ts
will be generated and with the default configuration forcontent
intailwind.config.js
this will trigger an infinite loop. You have two options to fix this:- Configure GraphQL Typegen’s
typesOutputPath
option to generate the file in another place - Adapt the
content
array to not include thesrc/gatsby-types.d.ts
file, for example:
- Configure GraphQL Typegen’s
Other resources
Start building today on Netlify!