@cobalt-ui/plugin-json
Advanced tools
Comparing version 0.3.1 to 0.3.2
# @cobalt-ui/plugin-json | ||
## 0.3.2 | ||
### Patch Changes | ||
- 67d271e: Update README | ||
- 8f5025d: Update package description | ||
## 0.3.1 | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "@cobalt-ui/plugin-json", | ||
"description": "JSON builder for Cobalt UI design tokens", | ||
"version": "0.3.1", | ||
"description": "Generate JSON from your design tokens schema (requires @cobalt-ui/cli)", | ||
"version": "0.3.2", | ||
"author": { | ||
@@ -21,3 +21,3 @@ "name": "Drew Powers", | ||
"devDependencies": { | ||
"@cobalt-ui/core": "^0.3.2" | ||
"@cobalt-ui/core": "^0.3.3" | ||
}, | ||
@@ -28,3 +28,3 @@ "scripts": { | ||
}, | ||
"readme": "# @cobalt-ui/plugin-json\n\nGenerate JSON output from design tokens.\n\n```\nnpm i -D @cobalt-ui/plugin-json\n```\n\n```js\n// tokens.config.mjs\nimport json from '@cobalt-ui/plugin-json';\n\nexport default {\n plugins: [\n json({\n /** set the filename inside outDir */\n filename: './tokens.json',\n /** modify values */\n transformValue(value, token) {\n return value;\n },\n }),\n ],\n};\n```\n" | ||
"readme": "# @cobalt-ui/plugin-json\n\nGenerate JSON output from design tokens.\n\n```\nnpm i -D @cobalt-ui/plugin-json\n```\n\n```js\n// tokens.config.mjs\nimport json from '@cobalt-ui/plugin-json';\n\nexport default {\n plugins: [\n json({\n /** set the filename inside outDir */\n filename: './tokens.json',\n }),\n ],\n};\n```\n\nIt’s worth noting that this JSON output differs from your source `tokens.json` in a number of ways:\n\n- It’s one flat array, making iterating over all your tokens easy without deep-crawling objects\n- All values are normalized, so you won’t get unexpected missing values\n- All shared properties are filled in, e.g. if a group has a default `type` it will be applied to all children tokens\n- All aliases are resolved, so you don’t have to recursively crawl `tokens.json` yourself\n- The original token value can be found in `_original`\n- Information about a token’s parent group can be found in `_group`\n\nSo if you have need for any of the above, this format can be much friendlier to iterate over than the original schema.\n" | ||
} |
@@ -18,6 +18,2 @@ # @cobalt-ui/plugin-json | ||
filename: './tokens.json', | ||
/** modify values */ | ||
transformValue(value, token) { | ||
return value; | ||
}, | ||
}), | ||
@@ -27,1 +23,12 @@ ], | ||
``` | ||
It’s worth noting that this JSON output differs from your source `tokens.json` in a number of ways: | ||
- It’s one flat array, making iterating over all your tokens easy without deep-crawling objects | ||
- All values are normalized, so you won’t get unexpected missing values | ||
- All shared properties are filled in, e.g. if a group has a default `type` it will be applied to all children tokens | ||
- All aliases are resolved, so you don’t have to recursively crawl `tokens.json` yourself | ||
- The original token value can be found in `_original` | ||
- Information about a token’s parent group can be found in `_group` | ||
So if you have need for any of the above, this format can be much friendlier to iterate over than the original schema. |
8135
33