Skip to content

Theemo / @theemo/style-dictionary / isNoConstrainedToken

Function: isNoConstrainedToken()

ts
function isNoConstrainedToken(token): boolean;

Defined in: filters/constraints.ts:139

Checks whether a token has NO containts.

A constrained token:

json
{
  "$value": {
    "value": "#ff0088",
    "features": {
      "color-scheme": "light"
    }
  },
  "$type": "color"
}

Parameters

ParameterTypeDescription
tokenTransformedTokenthe token in question

Returns

boolean

true when the token has NO constraints, otherwise false

Example

Usage:

js
import StyleDictionary from 'style-dictionary';
import { isNoConstrainedToken } from '@theemo/style-dictionary';

export default {
  source: ['tokens/**/*.json'],
  platforms: {
    css: {
      files: [
        {
          format: 'css/variables',
          destination: 'raw-tokens.css',
          filter: isNoConstrainedToken
        }
      ]
    }
  }
};