Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@tokens-studio/sd-transforms
Advanced tools
A utility that transforms a style-dictionary object into something Figma Tokens plugin understands
This package contains 3 custom transforms for Style-Dictionary, to work with Design Tokens that are exported from Tokens Studio:
px
as a unit when missingrgba()
formatname/cti/camelCase
as a transform group called tokens-studio
import { registerTransforms } from '@tokens-studio/sd-transforms';
// will register them on StyleDictionary object
// that is installed as a dependency of this package,
// in most case this will be npm install deduped with your installation,
// thus being the same object as you use
registerTransforms();
// or pass your own StyleDictionary object to it in case the former doesn't work
registerTransforms(sdObject);
In your Style-Dictionary config:
{
"source": ["**/*.tokens.json"],
"platforms": {
"js": {
"transformGroup": "tokens-studio",
"buildPath": "build/js/",
"files": [
{
"destination": "variables.js",
"format": "javascript/es6"
}
]
},
"css": {
"transformGroup": "tokens-studio",
"transforms": ["name/cti/kebab"],
"buildPath": "build/css/",
"files": [
{
"destination": "variables.css",
"format": "css/variables"
}
]
}
}
}
More fine-grained control:
import module from 'module';
import { transformDimension } from '@tokens-studio/sd-transforms';
const require = module.createRequire(import.meta.url);
const StyleDictionary = require('style-dictionary');
StyleDictionary.registerTransform({
name: 'my/size/px',
type: 'value',
transitive: true,
matcher: token => ['fontSizes', 'dimension', 'borderRadius', 'spacing'].includes(token.type),
transformer: token => transformDimension(token.value),
});
If you use CommonJS, no problem, you can use this package as CommonJS just fine!
const { registerTransforms } = require('@tokens-studio/sd-transforms');
0.2.0
FAQs
Custom transforms for Style-Dictionary, to work with Design Tokens that are exported from Tokens Studio
The npm package @tokens-studio/sd-transforms receives a total of 53,934 weekly downloads. As such, @tokens-studio/sd-transforms popularity was classified as popular.
We found that @tokens-studio/sd-transforms demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.