Skip to content

Commit

Permalink
wip: add figma percent
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlnf committed May 30, 2024
1 parent a3ae658 commit 4870e8d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/design/tokens-builder/src/tokens-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ async function build({ source, tokens, platforms }: TokenBuilderOptions) {
},
});

styleDictionary.registerTransform({
name: "letterSpacing/percentage",
type: "value",
filter: function (token) {
return token.attributes?.item === "letterSpacing";
},
transform: function (token) {
const parsed = Number(token.$value.replace("rem", ""));
return `${parsed * 100}%`;
},
});

styleDictionary.registerTransformGroup({
name: "css/custom",
transforms: [
Expand Down Expand Up @@ -328,6 +340,7 @@ async function build({ source, tokens, platforms }: TokenBuilderOptions) {
"lineHeight/px",
"color/hex", // TODO: review,
"shadow/css/shorthand",
"letterSpacing/percentage",
],
});

Expand Down

0 comments on commit 4870e8d

Please sign in to comment.