style-dictionary
Advanced tools
Changelog
4.3.2
'size/rem'
=> sizeRem
transform to not change values with 'px'
units to 'rem'
. Regression was added in v4.3.1
(commit sha 1684a8e).Changelog
4.3.1
Changelog
4.3.0
style-dictionary/enums
for most of the library's hard-coded string values. Most of these are built-in hooks names. This provides better type-safety for consumers as well as various maintainability related benefits for this library. See documentation for more info.tokenMap
properties to Dictionary, which is a JavaScript Map structure of the tokens, which makes it easy to iterate as well as access tokens. Also add convertTokenData
utility that allows to seemlessly convert between Map, Object or Array of tokens, and deprecate the flattenTokens
utility in favor of that one.outputReferencesTransformed
util, would return true
for tokens which original values were not strings.Changelog
4.2.0
style-dictionary/utils
-> stripMeta
for stripping metadata from tokens.
This utility is used now as an opt-in for the built-in 'json'
format by using options.stripMeta
, which if set to true
will strip Style Dictionary meta props.
You can specify keep
/strip
(allow/blocklist) for granular control about which properties to keep or strip.Changelog
4.1.4
convertToBase64
util to support converting binary files such as fonts, for both Browser and NodeJS.Changelog
4.1.3
defaultMessage
param in FileHeader type optional.sortByReference
function for DTCG token format, ensuring token references are declared after their targetsfilterTokens
utility to deal with random metadata properties throughout token groups, without throwing errors.Changelog
4.1.2
Changelog
4.1.1
iosSwiftEnumOpts.className
and iosSwiftAnyOpts.className
formats property documentationcopy_assets
do and undo methods, since they affect directories, not files.Changelog
4.1.0
ccf27b7: Prevent duplicate redundant calls to StyleDictionary class methods by caching platform specific config & tokens results.
Added reusable methods:
getPlatformTokens()
-> grabs the tokens
/allTokens
(new! exportPlatform
does not return this) for a specific platform, after running platform specific preprocessors and transforms. This replaces the old exportPlatform
method which is now deprecated and will be removed in v5.getPlatformConfig()
-> grabs the processed/transformed PlatformConfig
for a specific platform, replaces the now deprecated getPlatform
method which will be removed in v5.The reasons for deprecating those methods and replacing them with new ones is to reduce method ambiguity and make them more pure.
Add new options object to methods:
getPlatformTokens
getPlatformConfig
exportPlatform
(deprecated, see above)getPlatform
(deprecated, see above)formatPlatform
formatAllPlatforms
buildPlatform
buildAllPlatforms
cleanPlatform
cleanAllPlatforms
with property cache
, which if set to false
, will disable this caching of generating the platform specific config / tokens, e.g.:
await sd.exportPlatform('css', { cache: false });
await sd.buildAllPlatforms('css', { cache: false });
Expectation is that this is usually not useful for majority of users, unless for example you're testing multiple runs of StyleDictionary while changing tokens or platform configs in between those runs.
2ec9a44: size/rem
transform to leave 0 (string or number) values as is, since 0 doesn't need a unit.
f317430: Added link to logging documentation inside all of the warnings and errors that refer to verbosity.
6275983: Respect formatting
options in scss map-deep/map-flat formats, those that make sense:
commentPosition
commentStyle
indentation
Also export a new type interface FormattingOverrides
, which is a limited version of FormattingOptions
.
These contain the formatting options that can be overridden by users, whereas the full version is meant for the format helper utilities such as createPropertyFormatter
/formattedVariables
.
Changelog
4.0.1