Skip to content

Commit

Permalink
Feat: Updated json format in dist folder (#25)
Browse files Browse the repository at this point in the history
* Feat: Added tokens in json format to dist folder

* Feat: Updated json format in dist folder

* Delete violet-coats-pull.md
  • Loading branch information
vicky-comeau authored Nov 2, 2022
1 parent 12d975f commit e7e062f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-trainers-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@igloo-ui/tokens': minor
---

Updated the json format in dist folder
13 changes: 13 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"files": [
{
"destination": "tokens.json",
"format": "json"
"format": "custom/json"
}
]
},
Expand Down Expand Up @@ -112,7 +112,7 @@
"files": [
{
"destination": "tokens.json",
"format": "json"
"format": "custom/json"
}
],
"options": {
Expand Down

0 comments on commit e7e062f

Please sign in to comment.