Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/plugin-sass-forward-css-localid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@terrazzo/plugin-sass": patch
---

Forward the CSS plugin's `localID` when registering the sass transform, so any `variableName` customization (prefixes, casing) configured on plugin-css is honored by the generated `$__token-values` Sass map.

Previously, plugin-sass's `transform` hook set `localID: token.id` (the dotted DTCG id), which `build.ts` then read via `getTransforms({ format: FORMAT_ID })` and turned into a CSS variable name from scratch — bypassing the CSS plugin's `variableName` and producing `var(--color-blue)` instead of `var(--ds-color-blue)` (for a `variableName` configured with a `ds` prefix, as in the test fixtures) in the main token-values map. The typography mixins map was unaffected because that loop queries `format: 'css'` directly.

Regression introduced in 2.2.0 (PR #589) when the main loop in `build.ts` switched from `format: 'css'` to `format: FORMAT_ID`.
2 changes: 1 addition & 1 deletion packages/plugin-sass/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Please install @terrazzo/plugin-css and follow setup to add to your config.`,

setTransform(token.id, {
format: FORMAT_ID,
localID: token.id,
localID: token.localID,
value,
meta: { 'token-listing': { name: listingName } },
});
Expand Down
28 changes: 14 additions & 14 deletions packages/plugin-sass/test/fixtures/basic/want.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
@use "sass:map";

$__token-values: (
"border.std": var(--border-std),
"color.blue": var(--color-blue),
"color.green": var(--color-green),
"color.red": var(--color-red),
"color.redgreenblue": var(--color-redgreenblue),
"gradient.g-b": var(--gradient-g-b),
"shadow": var(--shadow),
"transition": var(--transition),
"typography.body": var(--typography-body),
"typography.callout": var(--typography-callout),
"typography.family.body": var(--typography-family-body),
"typography.family.heading": var(--typography-family-heading),
"typography.page-title": var(--typography-page-title),
"typography.subheading": var(--typography-subheading)
"border.std": var(--ds-border-std),
"color.blue": var(--ds-color-blue),
"color.green": var(--ds-color-green),
"color.red": var(--ds-color-red),
"color.redgreenblue": var(--ds-color-redgreenblue),
"gradient.g-b": var(--ds-gradient-g-b),
"shadow": var(--ds-shadow),
"transition": var(--ds-transition),
"typography.body": var(--ds-typography-body),
"typography.callout": var(--ds-typography-callout),
"typography.family.body": var(--ds-typography-family-body),
"typography.family.heading": var(--ds-typography-family-heading),
"typography.page-title": var(--ds-typography-page-title),
"typography.subheading": var(--ds-typography-subheading)
);

$__token-typography-mixins: (
Expand Down
Loading