Skip to content

Commit

Permalink
Convert shadow values
Browse files Browse the repository at this point in the history
  • Loading branch information
Anboias committed Jan 12, 2024
1 parent 79adb58 commit e239cf1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion transformToW3C.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fs.readFile("tokens/converted-tokens.json", "utf8", (err, data) => {
}

// As of now, only "value", "type", "category" and "extensions" are prepended with $
// Format types to match W3C format: https://second-editors-draft.tr.designtokens.org/format/
const convertedData = data
.replace(/"value":/g, '"$value":')
.replace(/"type":/g, '"$type":')
Expand All @@ -16,7 +17,11 @@ fs.readFile("tokens/converted-tokens.json", "utf8", (err, data) => {
.replace(/: "fontWeights"/g, ': "fontWeight"')
.replace(/: "fontFamilies"/g, ': "fontFamily"')
.replace(/: "fontSizes"/g, ': "fontSize"')
.replace(/: "lineHeights"/g, ': "lineHeight"');
.replace(/: "lineHeights"/g, ': "lineHeight"')
.replace(/"x"/g, '"offsetX"')
.replace(/"y"/g, '"offsetY"')
.replace(/"\$type": "dropShadow"/g, '"$type": "shadow"')
.replace(/"\$type": "boxShadow"/g, '"$type": "shadow"');

fs.writeFile(
"tokens/converted-tokens-w3c.json",
Expand Down

0 comments on commit e239cf1

Please sign in to comment.