1. 7
    Configure Tailwind purging in a Nx Workspace
    5m 10s

Configure Tailwind purging in a Nx Workspace

Share this video with your friends

Send Tweet

In development mode, Tailwind might be several hundred Kb large, if not into the megabytes depending on which classes you use. That's definitely not something we want to ship to our production environment. Therefore, Tailwind comes with CSS purging, a build step that analyzes your HTML, components, etc and removes all the unused Tailwind CSS from the overall bundle, shrinking down the Tailwind CSS to the bare minimum.

Normally you would just set this up for the app you're installing Tailwind for, but in a Nx workspace, you might have multiple apps and multiple libraries (shared or not). Hence, we don't just want to purge app-specific HTML files, but also those of the libs we use. Nx comes with built-in support to automatically generate glob patterns based on the libraries consumed by a given application.

Prefer to read along as well? Here's the accompanying article.