Styledictionary/4/Hook Api Filters

/icons/calendar.svg

Last update

Oct 7, 2024

This codemod updates registered filters to be placed inside the hooks.filters property, instead of filter. Note the shift from the singular to the plural form in this update.

Before

export default {
filter: {
'colors-only': (token) => token.type === 'color',
},
platforms: {
css: {
files: [
{
format: 'css/variables',
destination: '_variables.css',
filter: 'colors-only',
},
],
},
},
};

After

export default {
platforms: {
css: {
files: [
{
format: 'css/variables',
destination: '_variables.css',
filter: 'colors-only',
},
],
},
},
hooks: {
filters: {
'colors-only': (token) => token.type === 'color',
},
},
};

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now