From e7e062f53983f298325517d19a20d21dc0f957fd Mon Sep 17 00:00:00 2001 From: vicky-comeau <110498164+vicky-comeau@users.noreply.github.com> Date: Wed, 2 Nov 2022 09:01:24 -0400 Subject: [PATCH] Feat: Updated json format in dist folder (#25) * Feat: Added tokens in json format to dist folder * Feat: Updated json format in dist folder * Delete violet-coats-pull.md --- .changeset/big-trainers-care.md | 5 +++++ build.js | 13 +++++++++++++ config.json | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .changeset/big-trainers-care.md diff --git a/.changeset/big-trainers-care.md b/.changeset/big-trainers-care.md new file mode 100644 index 0000000..e09fec4 --- /dev/null +++ b/.changeset/big-trainers-care.md @@ -0,0 +1,5 @@ +--- +'@igloo-ui/tokens': minor +--- + +Updated the json format in dist folder diff --git a/build.js b/build.js index c31c344..cc1642f 100644 --- a/build.js +++ b/build.js @@ -61,6 +61,19 @@ StyleDictionary.registerFormat({ }, }); +StyleDictionary.registerFormat({ + name: 'custom/json', + formatter: function ({ dictionary }) { + + const result = {}; + dictionary.allTokens.map((token) => { + result[token.name] = token.value; + }); + + return JSON.stringify(result, null, 2); + }, +}); + StyleDictionary.registerFormat({ name: 'custom/doc', formatter: function ({ dictionary }) { diff --git a/config.json b/config.json index 36fe324..823095f 100644 --- a/config.json +++ b/config.json @@ -50,7 +50,7 @@ "files": [ { "destination": "tokens.json", - "format": "json" + "format": "custom/json" } ] }, @@ -112,7 +112,7 @@ "files": [ { "destination": "tokens.json", - "format": "json" + "format": "custom/json" } ], "options": {