Skip to content

Pre-defined transform without matcher logic #1292

Answered by jorenbroekema
TrevorRice asked this question in Q&A
Discussion options

You must be logged in to vote

Hm no this is currently not possible, transforms aren't exposed publicly without the attached matcher/filter (called filter in v4).

I'd be open to making the transforms themselves available without the filters though, feel free to raise an issue and I'll mark it as enhancement

You can kinda do it in v4:

const colorHslBuiltin = StyleDictionary.hooks.transforms['color/hsl'];
StyleDictionary.registerTransform({
  ...colorHslBuiltin,
  filter: (token) => token.type === 'colors',
  name: 'colors/hsl', // if you don't override the name it will register on the original name and override the built-in one, which might be nice
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TrevorRice
Comment options

Answer selected by jorenbroekema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants