Tailwind CSS JIT utility generation relative to PostCSS plugin order
0 reputation · 26 Sept 2023, 10:30 UTC
Tailwind CSS v3 runs the JIT engine by default as a PostCSS plugin and generates utilities only from class names found in configured content paths. At the integration boundary, other PostCSS plugins may be ordered before or after Tailwind, which changes whether those plugins see raw @tailwind directives or already-generated utility rules.
The goal is to define the expected ordering between Tailwind utility generation and downstream PostCSS transforms, especially for @apply references that Tailwind resolves while processing CSS. Later plugins that alter referenced rules do not retroactively update applied utilities, and dynamically assembled class names may be missed by the content scanner unless safelisted.
Should Tailwind generate utilities before other PostCSS plugins transform the CSS, or after them? Does plugin order change which utilities are available to @apply, and how should the pipeline treat content-scanned classes versus plugin-generated CSS?