Tailwind CSS v3 content path resolution in nested project layouts
0 reputation · 18 Feb 2023, 01:03 UTC
Tailwind CSS v3 runs the Just-In-Time engine by default and generates utility CSS only from class names found in files matched by the content array. The goal is to scan utility classes used across multiple packages in a monorepo where tailwind.config.js lives in a subdirectory rather than the repository root.
Because content globs resolve relative to the configuration file location, it is unclear whether patterns can reach sibling packages outside that directory, and whether dynamically assembled class names in those packages require the safelist option to appear in the built CSS. This question assumes Tailwind CSS v3.x and should be confirmed against the installed version before changing build configuration.
Can content globs reference directories above or beside the configuration file? What relative path syntax reliably includes sibling packages without breaking on different operating systems? Must runtime-assembled class names be added to safelist even when the files containing them are already scanned?