@divriots/style-dictionary-to-figma
Advanced tools
Changelog
0.4.0
ab01a1e: BREAKING: if an upper token group does not have a tokenset property, it will get placed in a "global" tokenset by default. This means that no action is required by the user of the transformer to get a working JSON for Figma Tokens Plugin, but this change is potentially breaking because of how it changes the JSON output.
{
"core": {
"color": {
"primary": {
"base": {
"type": "color",
"value": "#14b8a6"
},
"secondary": {
"type": "color",
"value": "#ff0000"
}
}
}
}
}
Nothing is changed in the output. However, if you have references, they might be broken because the plugin will interpret this as "color"
being the upper property in a tokenset called "core"
.
{
"core": {
"color": {
"primary": {
"base": {
"type": "color",
"value": "#14b8a6"
},
"secondary": {
"type": "color",
"value": "#ff0000"
}
}
}
}
}
turns into
{
"global": {
"core": {
"color": {
"primary": {
"base": {
"type": "color",
"value": "#14b8a6"
},
"secondary": {
"type": "color",
"value": "#ff0000"
}
}
}
}
}
}
Your reference, for example {core.color.primary.base}
will now work properly because "core"
is not interpreted as the tokenset, "global"
is.
Changelog
0.3.3
2c9be59: Allow tokensets to be the same name as the upper most keys in the tokens object, e.g.:
{
"core": {
"tokenset": "core",
"color": {
"value": "#ff0000",
"type": "color"
}
}
}
will become
{
"core": {
"core": {
"color": {
"value": "#ff0000",
"type": "color"
}
}
}
}
so that Figma Tokens plugin picks it up properly.
Changelog
0.3.2
cleanMeta
, to clean unwanted meta props from the style-dictionary object.Changelog
0.3.1
Changelog
0.3.0
ignoreUseRefValue
(see README) to fall back to keeping the fully resolved value. Currently, a hybrid solution that restores only the subparts of a value that is partially using references, is not available. Feel free to raise an issue if needed to explain your use case.Changelog
0.2.1
Changelog
0.2.0
00c39e3: BREAKING: no longer using default export, this is considered an anti-pattern for JS libraries. Re-export wildstars with default exports in ESM is one example quirk, another example is CommonJS not supporting default exports next to named exports in a single file. Now, the main export is a named export called "transform" and you have to import it as such.
Before:
// ESM
import styleDictionaryToFigma from '@divriots/style-dictionary-to-figma';
// CommonJS
const styleDictionaryToFigma = require('@divriots/style-dictionary-to-figma');
styleDictionaryToFigma({...}) // figma object
After:
// ESM
import { transform } from '@divriots/style-dictionary-to-figma';
// CommonJS
const { transform } = require('@divriots/style-dictionary-to-figma');
transform({...}) // figma object
Changelog
0.1.3