From 2885ff1cc597acb6e41bc70be587645c99ebaa6b Mon Sep 17 00:00:00 2001 From: Howard Chiam Date: Sat, 6 Jan 2024 22:58:32 -0700 Subject: [PATCH] undo part of 327a70f (#392) to fix #455 to make figma-tokens plugin work again (#456) --- build/to-figmatokens.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/build/to-figmatokens.js b/build/to-figmatokens.js index a5294284..85c63503 100644 --- a/build/to-figmatokens.js +++ b/build/to-figmatokens.js @@ -15,25 +15,25 @@ export const toFigmaTokens = props => { .map(hueName => hueName.toLowerCase()) let isColor = colors.some(color => key.includes(color)) - if (isLength) meta.$type = 'sizing' - else if (isBorder) meta.$type = 'borderWidth' - else if (isRadius) meta.$type = 'borderRadius' - else if (isShadow) meta.$type = 'boxShadow' - else if (isColor) meta.$type = 'color' - else meta.$type = 'other' + if (isLength) meta.type = 'sizing' + else if (isBorder) meta.type = 'borderWidth' + else if (isRadius) meta.type = 'borderRadius' + else if (isShadow) meta.type = 'boxShadow' + else if (isColor) meta.type = 'color' + else meta.type = 'other' - if (!(meta.$type in figmatokens)) figmatokens[meta.$type] = {} + if (!(meta.type in figmatokens)) figmatokens[meta.type] = {} if (isColor) { let color = /--(.+?)-/.exec(key)[1] - if (!(color in figmatokens[meta.$type])) figmatokens[meta.$type][color] = {} - figmatokens[meta.$type][color][key] = { - $value: token, + if (!(color in figmatokens[meta.type])) figmatokens[meta.type][color] = {} + figmatokens[meta.type][color][key] = { + value: token, ...meta, } } else { - figmatokens[meta.$type][key] = { - $value: token, + figmatokens[meta.type][key] = { + value: token, ...meta, } }