Repository navigation
Conversation
ehnruiz
marked this pull request as ready for review
October 11, 2026 08:23
…is emitted under Site Import turned root colour custom properties into framework tokens, which the framework emits under the normalised slug (`--brand---neutral--700` -> `--brand-neutral-700`), but left the imported `var()` references on the authored name, so they no longer resolved. The slug is now settled at plan time by `normalizeImportedColorTokens`, and every changed name is rewritten in the imported style rules and node inline styles before conflict detection, so the conflict step and the commit see the emitted name. Two names that normalise to the same slug both survive with a numeric suffix instead of one being dropped at commit. Token renames (normalisation and conflict renames) now also rename declarations of the variable in other rules, their priorities, and raw @Keyframes CSS, so a `.dark { --bg: ... }` override follows its token. Conflict rename targets skip the import's other token names and any custom property the imported CSS declares, and a colour custom rename is normalised like the slug it becomes. The rename helpers move from conflicts.ts into siteImport/varRefs.ts, which keeps conflicts.ts under the 700-line module budget. Fixes CoreBunch#615
ehnruiz
force-pushed
the
fix/import-color-token-refs
branch
from
October 15, 2026 20:40
9125aaa to
fd241f7
Compare
7 of 8 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #616. Site Import turns root-scope colour custom properties into framework colour tokens, and the framework emits each under its normalised slug (
normalizeFrameworkColorSlug), so--brand---neutral--700becomes--brand-neutral-700. The importedvar(--brand---neutral--700)references kept the authored name and no longer resolved. On the real 7-page Webflow site in the issue, that left 56 references (23 variables) unresolved.What changed:
normalizeImportedColorTokens(colorTokens.ts) gives each extracted token the slug the framework will emit and returns anauthored → emittedmap.buildImportPlanapplies it, rewrites the importedvar()references in style rules and node inline styles, and only then detects conflicts, so the conflict step, the review UI and the commit all see the emitted name.--Brand/--brand,--a--b/--a-b) used to lose one token silently at commit (addImportedColorTokensskips a slug it has already added). Now the name already in emitted form keeps it, and the other takes a-2,-3, ... suffix. A new name also avoids the other custom properties the imported CSS declares.!importantpriorities, and raw@keyframesCSS. Without this, a.dark { --brand---bg: #000 }override would stay on the old name and stop overriding. For conflict renames this changes existing behaviour: an imported override of a renamed token used to override the site's same-named token instead.Hero BG) now renames references to the slug it is stored under (hero-bg).conflicts.tsto a newsiteImport/varRefs.ts, which keepsconflicts.tsunder the 700-line module budget.Not changed, worth a follow-up:
--font-Headingis emitted as--font-headingwhilevar(--font-Heading)keeps the authored name. Kept out of this PR to keep it to one problem.mode: 'file') are byte-faithful and are not rewritten. A kept sheet that references a token extracted from a converted sheet can still miss a renamed name. This already applies to conflict renames today.Verification
bun run build(exit 0)bun teston this commit (9125aaa): 7047 pass, 0 fail (exit 0) on a quiet machine.--timeout 60000found one real failure:module-size-budgets(conflicts.tsat 743 lines). ThevarRefs.tssplit fixes it.bun x madge --circular --ts-config tsconfig.json --extensions ts,tsx src serverexits 0 with "No circular dependency found!"bun run lint(exit 0);tsc -p tsconfig.app.json --noEmit(exit 0)New tests fail without the fix and pass with it:
buildImportPlan): the issue's repro, plus a:rootalias, a.darkoverride and an inlinestylereference.normalizeImportedColorTokens: renames, collisions, declared names.@keyframesdeclarations are renamed.Checklist
docs/features/site-import.md).