fix(react-email): preserve local CSS variable overrides
MO
7d ago+143+143+012345678901234567890123456789-17-17-01234567890123456789
Closes #3794.
A custom utility that overrides a theme variable currently renders with the earlier root value. For example, a blue local --color-brand becomes red in the email's inline style.
Select the winning declaration in the same block before falling back to global definitions. Preserve existing direct !important matching and nested-rule checks. Index local definitions once; this does not implement the full CSS cascade.
Validation on Windows with Node 24 and pnpm 11:
- 158 Tailwind tests pass, including local overrides, declaration order, important defaults and public rendering.
pnpm lint,pnpm --filter react-email typecheckandpnpm --filter react-email buildpass.- The minimal reproduction fails on 6.11.3 and passes against the built, installed tarball.
- Full package suite: 325 pass, 4 fail. The same four CLI export/path assertions fail on untouched code; no new failures. They concern plugin process exit, two dynamic-import alias cases and root-directory matching.
Summary by cubic
Fixes local theme-variable overrides in custom utilities being ignored in favor of earlier global defaults.
- Selects the winning declaration within the same block before falling back to global definitions.
- Preserves existing
!importantmatching and nested-rule checks. - Indexes local definitions once rather than implementing the full CSS cascade.