Theemo / @theemo/style-dictionary / isConstrainedToken
Function: isConstrainedToken()
ts
function isConstrainedToken(token): boolean;
Defined in: filters/constraints.ts:91
Checks whether a token has containts.
A constrained token:
json
{
"$value": {
"value": "#ff0088",
"features": {
"color-scheme": "light"
}
},
"$type": "color"
}
Parameters
Parameter | Type | Description |
---|---|---|
token | TransformedToken | the token in question |
Returns
boolean
Example
Usage:
js
import StyleDictionary from 'style-dictionary';
import { isConstrainedToken } from '@theemo/style-dictionary';
export default {
source: ['tokens/**/*.json'],
platforms: {
css: {
files: [
{
format: 'css/variables',
destination: 'constrained-tokens.css',
filter: isConstrainedToken
}
]
}
}
};