Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A Gatsby starter that combines Tailwind CSS utility classes with Emotion CSS-in-JS for styling React components.
Gatsby Tailwind Emotion Starter is a Gatsby.js boilerplate that combines Tailwind CSS utility classes with Emotion CSS-in-JS, letting React components load only the styles they actually use.
Gatsby Tailwind Emotion Starter is a starter project created by muhajirdev that scaffolds a new Gatsby site with Tailwind CSS and Emotion preconfigured. Input: a GitHub repository URL passed to gatsby new. Output: a working Gatsby project where you can write React components styled with Emotion's styled and Tailwind utility classes via the tw template literal tag. The starter is based on the author's own gatsby-plugin-tailwindcss, and it runs entirely on Gatsby's static site generation framework.
tw tag within a styled template string.gatsby new my-new-website https://github.com/muhajirdev/gatsby-tailwind-emotion-starter; no extra config files to write.npm run develop starts a live-reload dev server; npm run build generates a production-ready static site in /public.react-tailwind-emotion-starter for create-react-app and a VS Code snippets extension for Tailwind styled components.npm run build and hosting the generated public folder on any static host.Use the Gatsby CLI to pull the starter: install the CLI with npm install --global gatsby-cli, run gatsby new with the repository URL, then cd into the project. npm run develop starts the local dev server, and npm run build compiles the site to /public.
Yes, it is open source on GitHub and you can use it freely, including for commercial projects.
Create an Emotion component with styled.div (or another tag) and include the tw tag inside the template string. The starter wires the tw tag to parse Tailwind utilities at build time.
Plain Tailwind ships a large CSS file (roughly 1.5 times bigger than Bootstrap), and the official docs recommend purging unused classes. Emotion solves this by automatically bundling only the utilities that appear in your components.