Site Import: imported color tokens are renamed, but var() references to them are not rewritten
Summary
When Site Import turns root-scope color custom properties into framework color tokens, it removes the original declaration and re-emits the token under a normalized name. It does not rewrite the var() references in the imported style rules, so any name that normalization changes ends up unresolved.
Steps to reproduce
- Import a static site whose stylesheet contains:
:root { --brand---neutral--700: #4f5459; --brand-primary: #0575d6; } .title { color: var(--brand---neutral--700); } .link { color: var(--brand-primary); } - Accept the two color tokens in the review step, then publish.
- Open the published
framework-*.cssandstyle-*.css.
Expected behavior
Either the token keeps its authored name, or every var(--brand---neutral--700) in the imported rules is rewritten to the new name. The docs say renames rewrite var(--x) references, but that seems to happen only for conflict renames.
Actual behavior
framework-*.cssdefines--brand-neutral-700and--brand-primary..titlestill usesvar(--brand---neutral--700), which is no longer defined anywhere, so the color is lost..linkworks only because its name happened to survive normalization.
As far as I can tell, extractRootColorTokens stores the slug as prop.slice(2) (src/core/siteImport/colorTokens.ts:107). The framework then emits it through normalizeFrameworkColorSlug (src/core/framework/colors.ts), which collapses every run of non-alphanumeric characters to a single - and also turns _ into -. Nothing maps the authored name to the emitted one for the rules that reference it.
Possible fixes: carry the authored name as the emitted variable when it is a valid identifier, or record authored → normalized during import and rewrite var() references the way conflict renames already do.
Scale, from a real 7-page Webflow site: 218 color tokens were extracted, and 56 references (23 distinct variables) were left unresolved. Moving the variables to a non-root selector (:root, [data-x]) avoids extraction and is a workable stopgap.
Version or commit
0.0.20 (f92e8dc, current main)
Deployment mode
Local, bun run start (SQLite), Bun 1.4.2, macOS