Skip to content

Commit

Permalink
feat: registers sd-transforms; includes refs in source-tokens-only ou…
Browse files Browse the repository at this point in the history
…tput; resolves refs warnings (#3219)
  • Loading branch information
adamstankiewicz authored Sep 9, 2024
1 parent 029325a commit daffd74
Show file tree
Hide file tree
Showing 10 changed files with 440 additions and 179 deletions.
7 changes: 6 additions & 1 deletion lib/build-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path');
const minimist = require('minimist');
const {
initializeStyleDictionary,
getTokensStudioTransforms,
colorTransform,
} = require('../tokens/style-dictionary');
const { createIndexCssFile } = require('../tokens/utils');
Expand Down Expand Up @@ -56,9 +57,14 @@ async function buildTokensCommand(commandArgs) {
source: tokensSource
? [`${tokensSource}/core/**/*.json`, `${tokensSource}/core/**/*.toml`]
: [],
preprocessors: ['pgn-annotate-token-extensions-with-references', 'tokens-studio'],
expand: {
typesMap: (await getTokensStudioTransforms()).expandTypesMap,
},
platforms: {
css: {
prefix: 'pgn',
transformGroup: 'paragon-css',
// NOTE: buildPath must end with a slash
buildPath: buildDir.slice(-1) === '/' ? buildDir : `${buildDir}/`,
options: {
Expand All @@ -82,7 +88,6 @@ async function buildTokensCommand(commandArgs) {
},
},
],
transforms: StyleDictionary.hooks.transformGroups.css.filter(item => item !== 'size/rem').concat('color/sass-color-functions', 'str-replace'),
},
},
log: {
Expand Down
64 changes: 64 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@
"playroom:build": "npm run playroom:build --workspace=www",
"prepare": "husky || true",
"build-tokens": "./bin/paragon-scripts.js build-tokens --build-dir ./styles/css",
"build-tokens:watch": "npx nodemon --ignore styles/css -x \"npm run build-tokens\"",
"replace-variables-usage-with-css": "./bin/paragon-scripts.js replace-variables -p src -t usage",
"replace-variables-definition-with-css": "./bin/paragon-scripts.js replace-variables -p src -t definition",
"cli:help": "./bin/paragon-scripts.js help"
},
"dependencies": {
"@popperjs/core": "^2.11.4",
"@tokens-studio/sd-transforms": "^1.2.4",
"axios": "^0.27.2",
"bootstrap": "^4.6.2",
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion styles/css/core/custom-media-breakpoints.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* See <root>/tokens/README.md for more details.
*/

@custom-media --pgn-size-breakpoint-min-width-xs (min-width: 0);
@custom-media --pgn-size-breakpoint-min-width-xs (min-width: 0px);
@custom-media --pgn-size-breakpoint-max-width-xs (max-width: 576px);
@custom-media --pgn-size-breakpoint-min-width-sm (min-width: 576px);
@custom-media --pgn-size-breakpoint-max-width-sm (max-width: 768px);
Expand Down
Loading

0 comments on commit daffd74

Please sign in to comment.