Skip to content

Commit

Permalink
Tokens: July VR Tokens Fixes (pinterest#3718)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlingineni committed Aug 7, 2024
1 parent 663fa88 commit 643cce4
Show file tree
Hide file tree
Showing 8 changed files with 307 additions and 243 deletions.
17 changes: 17 additions & 0 deletions packages/gestalt-design-tokens/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,23 @@ StyleDictionary.registerTransform({
},
});

/**
* Adds 'px' ending to anything matching a font-size value
*/
StyleDictionary.registerTransform({
name: 'line-height/px',
type: 'value',
matcher: (prop) =>
prop.attributes.category === 'font' &&
prop.attributes.type === 'lineheight' &&
prop.attributes.prefix === 'sema',
transformer(prop) {
const val = parseFloat(prop.value);
if (Number.isNaN(val)) return val;
return `${val}px`;
},
});

StyleDictionary.registerFormat({
name: `constantLibrary-javascript/es6/vr-theme`,
formatter({ dictionary }) {
Expand Down
Loading

0 comments on commit 643cce4

Please sign in to comment.