Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 1x 4x 1x 1x | /**
* Filters tokens from config.json
* Config tokens are configuration flags used by components (e.g., --slds-is-v2-enabled)
* and are built separately from theme tokens since they're theme-independent
*/
import type { Config, Filter, TransformedToken } from 'style-dictionary/types';
import type { StyleDictionaryHost } from '../style-dictionary-host.js';
const CONFIG_FILE_PATH = '/common/config.json';
/**
* Filter function to identify config tokens based on file path
* @param {Object} token - Style Dictionary token object
* @returns {boolean} True if token is from config.json
*/
export const configFilterFunction = ((token: TransformedToken, _options: Config) =>
Boolean(token.filePath && token.filePath.includes(CONFIG_FILE_PATH))) satisfies Filter['filter'];
/**
* Registers the config filter with Style Dictionary
* Used in build.js to generate config.css separately from theme files
* @param {StyleDictionary} StyleDictionary - Style Dictionary instance
*/
export const configFilter = (StyleDictionary: StyleDictionaryHost) => {
StyleDictionary.registerFilter({
name: 'filter/config',
filter: configFilterFunction,
});
};
|