Skip to content

Theemo / @theemo/style-dictionary / isNoComputedToken

Function: isNoComputedToken()

ts
function isNoComputedToken(token): boolean;

Defined in: filters/computed.ts:97

Checks whether a token contains NO transforms.

A computed token:

json
{
  "$value": {
    "value": "#ee00aa",
    "transforms": {
      "alpha": -10
    }
  },
  "$type": "color"
}

Parameters

ParameterTypeDescription
tokenTransformedTokenthe token in question

Returns

boolean

true when the token contains NO transform, otherwise false

Example

Usage:

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

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