Skip to content

Commit

Permalink
update (style-dictionary): adding variables
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Aug 22, 2023
1 parent 3114730 commit d44d5ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
10 changes: 7 additions & 3 deletions design-system/style-dictionary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ npx style-dictionary init complete

In this case, you must:
* replace the `config.json` with our `config.js` to customize transformations, focusing on CSS;
* replace the initial generated tokens (`token` folder) with our tokens to use them.
* replace the initially generated tokens (`token` folder) with our tokens to use them.

## Build

Expand All @@ -31,11 +31,15 @@ npx style-dictionary build --config ./config-classes.js

* `config.js` -- default file
* `transform`: add specialized measures to the CSS output -- add the `rem` measure to shape specifications;
* `format`:
* `css/variables.css`: JSON tokens transformed in CSS variables.

* `config-classes.js`
* `transform`: add specialized measures to the CSS output -- add the `rem` measure to shape specifications;
* `format`: customized formats that load an extra `classes.json` file and generate:
* `classes/classes-resolved.json`: transforms classes.json tokens in their respective values;
* `css/classes-tokens.css`: transforms in CSS converting first-level properties in CSS classes and tokens to CSS variables;
* `classes/classes-resolved.json`: JSON classes with tokens transformed in their respective values;
* `css/variables.css`: JSON tokens transformed in CSS variables;
* `css/classes-tokens.css`: JSON classes transformed in CSS converting first-level properties in CSS classes and tokens to CSS variables;
* `css/classes-resolved.css`: same as the previous, but converting tokens in their respective values;
* `intermediary/aggregated-tokens.json`: an auxiliary file aggregating all tokens in a single hierarchical file.

Expand Down
2 changes: 1 addition & 1 deletion design-system/style-dictionary/build/css/variables.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Do not edit directly
* Generated on Sun, 20 Aug 2023 23:14:57 GMT
* Generated on Tue, 22 Aug 2023 11:25:09 GMT
*/

:root {
Expand Down
22 changes: 7 additions & 15 deletions design-system/style-dictionary/config-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,33 +123,25 @@ module.exports = {
'transforms': StyleDictionary.transformGroup['css'].concat(['shape/rem']),
"buildPath": "build/",
"files": [
{
"format": "css/variables",
"destination": "css/variables.css"
},
{
"format": "jsonAggregatedFormat",
"destination": "intermediary/aggregated-tokens.json",
"options": {
"showFileHeader": false
}
"destination": "intermediary/aggregated-tokens.json"
},
{
"format": "jsonResolvedFormat",
"destination": "classes/classes-resolved.json",
"options": {
"showFileHeader": false
}
"destination": "classes/classes-resolved.json"
},
{
"format": "cssClassFormat",
"destination": "css/classes-tokens.css",
"options": {
"showFileHeader": false
}
},
{
"format": "cssResolvedClassFormat",
"destination": "css/classes-resolved.css",
"options": {
"showFileHeader": false
}
"destination": "css/classes-resolved.css"
}
]
}
Expand Down

0 comments on commit d44d5ec

Please sign in to comment.