Styledictionary/4/Hook Api Filters

1.0.2Last update Jan 10, 2025
by@manishjha-04

What Changed

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