Updated greenwood.config.js accordingly to include the Greenwood PostCSS plugin
Set NODE_ENV=production in any of your build / serve related Greenwood commands to ensure automatic purging by Tailwind (if using Windows, use set or even better, the cross-env package)
"build": "NODE_ENV=production greenwood build",
If you using Stylelint, you may need to override at-rule-no-unknown in your Stylelint config
Overview
Per https://github.com/ProjectEvergreen/greenwood/discussions/523 wanted to get an example of TailwindCSS working with Greenwood. The intent isn't to merge this PR, but rather provide an example and demonstration for how to add it to a Greenwood project.
Steps
For the most part, I only had to follow the installation steps in the TailwindCSS docs, including the additional configuration needed for production builds and optimizations.
Create and configure a postcss.config.js and matching ESM version as postcss.config.mjs and pull in Tailwind and Autoprefixer dependencies
NODE_ENV=production
in any of yourbuild
/serve
related Greenwood commands to ensure automatic purging by Tailwind (if using Windows, useset
or even better, the cross-env package)at-rule-no-unknown
in your Stylelint configUsage
Now with all that setup, in src/styles/theme.css you can now add Tailwind CSS directives
Now you can run Greenwood! 💯 🙌
Develop
Serve (w/ purging)
NEEDS: https://github.com/ProjectEvergreen/greenwood/issues/833