amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.93k stars 557 forks source link

Allow references in metadata for transitive transforms #1073

Closed jorenbroekema closed 7 months ago

jorenbroekema commented 11 months ago

related issue: https://github.com/tokens-studio/sd-transforms/issues/211 but simplified in this example below:

{
  a: {
    value: 0.5
  },
  b: {
    value: '#fff',
    type: 'color',
    darken: '{a}'
  }
}

Imagine this situation where the ref is not in the value but in another prop, even if the transform that handles darkening is transitive, it won't get the 0.5 but rather '{a}' and the darken transformation will fail.

I see two approaches to tackle this: