Repository navigation
fix(plugin-sass): forward CSS plugin's localID in transform hook - #765
Merged
drwpow merged 3 commits intoJun 7, 2026
Merged
Conversation
The sass transform was setting `localID: token.id` (the dotted DTCG id), which the main `$__token-values` loop in build.ts then turned into a CSS variable name from scratch — bypassing the CSS plugin's `variableName` and producing `var(--color-blue-40)` instead of `var(--pcl-color-blue-40)`. The typography mixins map was unaffected because that loop queries `format: 'css'` directly. Forwarding `token.localID` instead preserves any prefix or casing customization configured via `variableName` on plugin-css. Regression introduced in 2.2.0 (PR terrazzoapp#589) when the main loop in build.ts switched from `format: 'css'` to `format: FORMAT_ID`.
🦋 Changeset detectedLatest commit: 79bd093 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The basic fixture configures plugin-css with a 'ds' variableName prefix. With localID now forwarded, the $__token-values Sass map correctly references the --ds- prefixed CSS variables, matching want.css.
drwpow
approved these changes
Jun 7, 2026
drwpow
left a comment
Collaborator
There was a problem hiding this comment.
Great fix! Agree with just updating the existing test here—this should cover the behavior. Ashamed I didn’t notice the prefix was missing in the fixture!
Merged
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 a regression in
@terrazzo/plugin-sasswhere the CSS plugin'svariableNamecustomization (prefixes, casing) was not honored by the generated$__token-valuesSass map.plugin-sass's
transformhook was settinglocalID: token.id(the dotted DTCG id), whichbuild.tsthen read viagetTransforms({ format: FORMAT_ID })and turned into a CSS variable name from scratch — bypassing the CSS plugin'svariableNameand producingvar(--color-blue-40)instead ofvar(--ds-color-blue-40). The typography mixins map was unaffected because that loop queriesformat: 'css'directly.Forwarding
token.localIDinstead preserves any prefix or casing customization configured viavariableNameon plugin-css.Root cause
Regression introduced in 2.2.0 (PR #589) when the main loop in
build.tsswitched fromformat: 'css'toformat: FORMAT_ID.Changes
packages/plugin-sass/src/index.ts: forwardtoken.localIDinstead oftoken.idin thesetTransformcall.@terrazzo/plugin-sass: patch).