You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When two or more arbitrary value utility classes reference CSS custom properties that share a common prefix (e.g., --sidebar-width and --sidebar-collapsed-width), Tailwind CSS v4.2.4 generates a single collapsed utility containing var(--sidebar-*) with a literal * character. This is not valid CSS and causes Lightning CSS to throw a parse error, crashing the dev server.
Then use md:ml-sidebar-width and md:ml-sidebar-collapsed in templates.
Notes
This does NOT happen when only one of the two classes is present — it requires both classes sharing the same utility (ml-) and CSS variable prefix (--sidebar-).
The same issue occurs with w-[var(--sidebar-width)] / w-[var(--sidebar-collapsed-width)].
Complex expressions like calc(var(--sidebar-width) + 10px) wrapped in functions do NOT trigger this — only bare var(--prefix-X) references.
Related: [v4] Namespace override syntax is not valid CSS #15602 (acknowledges * is not valid CSS in namespace context), but that issue covers theme-defined namespaces, not arbitrary value collapse in the normal build pipeline.
I searched open/closed issues for "namespace grouping", "var(--", "wildcard custom property", "arbitrary value collapse", "Delim('')" — no existing report found.
Description
When two or more arbitrary value utility classes reference CSS custom properties that share a common prefix (e.g.,
--sidebar-widthand--sidebar-collapsed-width), Tailwind CSS v4.2.4 generates a single collapsed utility containingvar(--sidebar-*)with a literal*character. This is not valid CSS and causes Lightning CSS to throw a parse error, crashing the dev server.Reproduction
pnpm devwith@tailwindcss/postcssResult: Lightning CSS parse error, page returns HTTP 500.
Expected Behavior
Two separate CSS rules generated:
Actual Behavior
A third "collapsed" utility is generated with a literal
*that is not valid CSS:Error:
This appears before the individual utilities in the compiled output (~line 5520), blocking the entire CSS compilation.
Environment
@tailwindcss/postcssWorkaround
Use
@utilitydirective to define named utilities, bypassing arbitrary value candidate generation:Then use
md:ml-sidebar-widthandmd:ml-sidebar-collapsedin templates.Notes
ml-) and CSS variable prefix (--sidebar-).w-[var(--sidebar-width)]/w-[var(--sidebar-collapsed-width)].calc(var(--sidebar-width) + 10px)wrapped in functions do NOT trigger this — only barevar(--prefix-X)references.*is not valid CSS in namespace context), but that issue covers theme-defined namespaces, not arbitrary value collapse in the normal build pipeline.