Skip to content

Commit

Permalink
fix: Filter out action tokens from generated variables.css (#141)
Browse files Browse the repository at this point in the history
`--cnvs-brand-action-**` tokens where always created and added to `variables.css`. When we consume these tokens in Canvas Kit, that token is **always** known, meaning the fallback of `--cnvs-brand-primary-**` would never get hit, breaking theming. 

This PR filters out the action tokens from out generated css files so that we can allow cascading of our actions tokens through the CanvasProvider.

[category:Tokens]

Release Note:
Removing `cnvs-brand-action-**` tokens to ensure proper cascading. These tokens won't be part of `variables.css`.

Co-authored-by: manuel.carrera <[email protected]>
  • Loading branch information
mannycarrera4 and manuel.carrera authored Feb 6, 2025
1 parent 0da45e6 commit 370f902
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/canvas-tokens/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const config = setConfig({
level: ['brand', 'sys'],
format: 'merge/refs',
combineWith: ['{platform}/composite', '{platform}/variables', '{platform}/shadow'],
filter: filters.filterActionTokens,
options: {
outputReferences: true,
},
Expand Down
5 changes: 5 additions & 0 deletions packages/canvas-tokens/utils/filters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ export const filterCodeTokens: Matcher = token => {
const excludedTokens = ['level', 'shadow', 'typescale'];
return !excludedTokens.includes(token.path[1]);
};

export const filterActionTokens: Matcher = token => {
const excludedTokens = ['action'];
return !excludedTokens.includes(token.path[1]);
};

0 comments on commit 370f902

Please sign in to comment.