Recent articles
Null vs Undefined: Stop Using the Wrong One
Dec 17, 2025
Pattern: Verifying Lambdas
Dec 16, 2025
Fixing Tailwind Culling in Monorepos
Dec 13, 2025

Pattern: Lambda Health Check
Dec 12, 2025

SwiftUI: Tips and Tricks
Nov 18, 2024
3D Printing at home
Jul 12, 2024
NestJS: benefits, cheatsheet and tips
Jul 12, 2024
mktouch = make directory + make file
Jun 28, 2024

Importing Rokoko character animations into Xcode using Blender
Jun 15, 2024

Importing Collada characters and animations from Mixamo into Xcode
Jun 13, 2024

Fixing Tailwind Culling in Monorepos
A practical pattern for preventing Tailwind from culling classes in shared monorepo components.
Dec 13, 2025
When using Tailwind CSS v4 in a monorepo with shared React component packages, you may hit a subtle issue where classes in shared components are not added to your computed CSS file.
This happens because Tailwind only generates CSS for utility classes it can statically detect in the files it scans. If a consuming application only scans its own source code, any classes defined inside a shared package are invisible to Tailwind and get culled from the final build.
Importing the component is not enough — Tailwind does not follow imports at runtime.
The Solution
Treat shared UI packages as first-class Tailwind citizens.
Shared component packages build their own CSS containing the utilities they use
Consuming applications scan both their own code and shared packages
This guarantees Tailwind sees every class, regardless of where it’s defined.
Implementation Specifics
Step 1: Configure the Shared Component Package
Your shared package should explicitly generate its own Tailwind output.
packages/ui-components/postcss.config.js
packages/ui-components/src/styles.css
packages/ui-components/package.json
This produces a dist/styles.css file containing all utilities required by the shared components.
At this point, your UI package fully owns its styling.
Step 2: Configure Consuming Applications
The consuming app must scan both its own code and the shared package, whether it’s linked locally or installed from node_modules.
packages/app/postcss.config.js
This ensures Tailwind detects classes regardless of how the package is resolved.
Step 3: Build in the Correct Order
Because the app depends on generated CSS from the shared package, build order matters.
Monorepo tooling can enforce this automatically (more on that below).
A note on the paths
Each path covers a different stage of the development lifecycle:
ui-components/src – Local workspace development
ui-components/dist – TypeScript output and generated artifacts
node_modules/@company/ui-components – Published package in CI or production
This redundancy is intentional. It eliminates environment-specific styling bugs.