Theemo / @theemo/style-dictionary / theemoTokenPreprocessor
Variable: theemoTokenPreprocessor
ts
const theemoTokenPreprocessor: Preprocessor;
Defined in: preprocessors/theemo-token.ts:44
Style Dictionary is parsing tokens according to the DTCG specification, for which token properties are prefixed with the $
sign, eg. $value
. Even in the parsed form, these persist as TransformedToken.$value
. However, that breaks compatibility with other token libraries, that work with Token.value
, such as our own @theemo/tokens
package.
For ecosystem compatibility, the theemo/token
preprocessor copies all fields starting with $
to a non-$
field.
Example
Usage:
js
import StyleDictionary from 'style-dictionary';
import { theemoTokenPreprocessor } from '@theemo/style-dictionary';
styleDictionary.registerPreprocessor(theemoTokenPreprocessor);
export default {
source: ['tokens/**/*.json'],
preprocessors: ['theemo/token']
};