@tokens-studio/sd-transforms
Advanced tools
Comparing version 0.8.1 to 0.8.2
export { registerTransforms } from './registerTransforms.js'; | ||
export { expandComposites } from './parsers/expand-composites.js'; | ||
export { excludeParentKeys } from './parsers/exclude-parent-keys.js'; | ||
export { mapDescriptionToComment } from './mapDescriptionToComment.js'; | ||
@@ -4,0 +5,0 @@ export { checkAndEvaluateMath } from './checkAndEvaluateMath.js'; |
export { registerTransforms } from './registerTransforms.js'; | ||
export { expandComposites } from './parsers/expand-composites.js'; | ||
export { excludeParentKeys } from './parsers/exclude-parent-keys.js'; | ||
export { mapDescriptionToComment } from './mapDescriptionToComment.js'; | ||
@@ -4,0 +5,0 @@ export { checkAndEvaluateMath } from './checkAndEvaluateMath.js'; |
@@ -14,2 +14,3 @@ import { transformDimension } from './transformDimension.js'; | ||
import { expandComposites } from './parsers/expand-composites.js'; | ||
import { excludeParentKeys } from './parsers/exclude-parent-keys.js'; | ||
import { transformOpacity } from './transformOpacity.js'; | ||
@@ -39,3 +40,4 @@ const isBrowser = typeof window === 'object'; | ||
const obj = JSON.parse(contents); | ||
const expanded = expandComposites(obj, filePath, transformOpts); | ||
const excluded = excludeParentKeys(obj, transformOpts); | ||
const expanded = expandComposites(excluded, filePath, transformOpts); | ||
return expanded; | ||
@@ -42,0 +44,0 @@ }, |
@@ -14,2 +14,3 @@ import { SingleBorderToken, SingleBoxShadowToken, SingleCompositionToken, SingleToken, SingleTypographyToken } from '@tokens-studio/types'; | ||
expand?: ExpandOptions | false; | ||
excludeParentKeys?: boolean; | ||
} |
{ | ||
"name": "@tokens-studio/sd-transforms", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "Custom transforms for Style-Dictionary, to work with Design Tokens that are exported from Tokens Studio", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -13,2 +13,3 @@ # Style Dictionary Transforms for Tokens Studio | ||
- Expands composition tokens into multiple, optionally also does so for typography, border and shadow tokens -> parser | ||
- Optionally excludes parent keys from your tokens file, e.g. when using single-file export from Tokens Studio Figma plugin -> parser | ||
- Maps token descriptions to comments -> `ts/descriptionToComment` | ||
@@ -109,2 +110,3 @@ - Check and evaluate Math expressions (transitive) -> `ts/resolveMath` | ||
}, | ||
excludeParentKeys: true, | ||
}); | ||
@@ -117,2 +119,3 @@ ``` | ||
| ------------------ | ------------------------ | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | ||
| excludeParentKeys | boolean | ❌ | `false` | Whether or not to exclude parent keys from your token files | | ||
| expand | boolean \| ExpandOptions | ❌ | See props below | `false` to not register the parser at all. By default, expands composition tokens. Optionally, border, shadow and typography as well. | | ||
@@ -123,2 +126,3 @@ | expand.composition | boolean \| ExpandFilter | ❌ | `true` | Whether or not to expand compositions. Also allows a filter callback function to conditionally expand per token/filePath | | ||
| expand.border | boolean \| ExpandFilter | ❌ | `false` | Whether or not to expand borders. Also allows a filter callback function to conditionally expand per token/filePath | | ||
| | | ||
@@ -186,3 +190,3 @@ > Note: you can also import and use the `expandComposites` function to run the expansion on your token object manually. | ||
> Note: make sure to choose either the full transformGroup, **OR** its separate transforms, so you can adjust or add your own. | ||
> Note: make sure to choose either the full transformGroup, **OR** its separate transforms so you can adjust or add your own. | ||
> [Combining a transformGroup with a transforms array can give unexpected results](https://github.com/amzn/style-dictionary/issues/813). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
172190
78
4882
188