Tips & Tidbits

Making tailwind IDE class completion work with PurgeCSS

If you're using tailwind but your IDE seems to be missing class autocomplete, it's probably because of PurgeCSS. Since it's stripping out all of the classes you haven't used, you'll never see suggestions from your ide.

The first option is to turn of PurgeCSS in development, and only enable it in production. This will ensure you get complete build (and thus completion will work)

If you don't want to muck around with the configuration of your project, just force a full tailwind build using tailwind's CLI. Your ide will then pick this up and use it to autocomplete classes, without having to modify any configuration.

npx tailwind build /path/to/tailwind.css -o /path/to/output.css  -c tailwind.config.js