From 46aae7105f1a17e43047d0980ddcb8b7690e8e0f Mon Sep 17 00:00:00 2001 From: josefie Date: Tue, 25 Oct 2022 09:46:42 +0200 Subject: [PATCH] allow for old token reference syntax when embedded inside a string value (#30) --- config/style-dictionary/parsers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/style-dictionary/parsers.js b/config/style-dictionary/parsers.js index a45957a7..f6bec308 100644 --- a/config/style-dictionary/parsers.js +++ b/config/style-dictionary/parsers.js @@ -7,7 +7,7 @@ StyleDictionary.registerParser({ // replace the old reference syntax with the one style-dictionary understands // e.g. "$fontFamilies.fira-sans" -> "{fontFamilies.fira-sans}" // see https://docs.tokens.studio/tokens/aliases - const tokens = JSON.parse(contents.replace(/\$([^"]+)/g, `{$1}`)) + const tokens = JSON.parse(contents.replace(/\$([^"\s]+)/g, `{$1}`)) // strip away the global key for global token set but keep the themes nested // this is necessary, because the references from Figma Tokens do not include the token set key