Theemo / @theemo/style-dictionary / matchesConstraints
Function: matchesConstraints()
ts
function matchesConstraints(token, constraints): boolean;
Defined in: filters/constraints.ts:43
When you want to filter for any constraints (free from platform constraints), you can make yourself a filter for that.
Parameters
Parameter | Type | Description |
---|---|---|
token | TransformedToken | the token in question |
constraints | Partial | the constraints you want to check against |
Returns
boolean
true
when the token matches against the given constraints, otherwise false
Example
Usage:
js
import StyleDictionary from 'style-dictionary';
import { matchesConstraints } from '@theemo/style-dictionary';
export default {
source: ['tokens/**/*.json'],
platforms: {
css: {
files: [
{
format: 'css/variables',
destination: 'raw-tokens.css',
filter: (token) => matchesConstraints(token, {
features: {
'density': 'spacious'
}
})
}
]
}
}
};