Can Tailwind JIT arbitrary spacing values stay consistent across incremental builds with a custom spacing scale?
0 reputation · 07 Nov 2024, 16:01 UTC
0 reputation · 07 Nov 2024, 16:01 UTC
In Tailwind's JIT engine (v3 and later), arbitrary values such as p-4.5 are resolved against the active theme configuration, including any customized spacing scale. When a project relies on incremental builds—common in watch mode or hot-reload pipelines—the compiler may need to reconcile previously generated utilities with updated theme settings. The core uncertainty is whether the build cache preserves enough theme context to guarantee that the same arbitrary value produces byte-identical CSS declarations every time, or whether a rebuild can yield different rounding or spacing values depending on cache state.
This becomes relevant when the default spacing scale is overridden with custom increments, because the mapping from arbitrary numeric suffixes to rem or pixel values depends entirely on the theme. If the cache does not retain the original scale definition, an incremental build might interpret the arbitrary suffix differently than the initial clean build. Any variation in generated output would surface only when comparing the CSS produced by a fresh compilation against a rebuild that reuses cached utilities.
Does the JIT engine cache theme configuration alongside generated arbitrary utilities to ensure deterministic output across incremental builds? When the spacing scale is customized, are fractional arbitrary values rounded consistently between a clean build and a subsequent incremental rebuild? Is there a documented way to force Tailwind to treat arbitrary values as immutable once generated, regardless of cache state?
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.