style-dictionary icon indicating copy to clipboard operation
style-dictionary copied to clipboard

Transitive transforms do not work well with references that don't have `.value` at the end

Open six7 opened this issue 2 years ago • 1 comments

When you use references that do not contain .value at the end transitive transforms do not work as expected.

In the transitive transforms example, when you swap out token references from {color.font.primary.value} to {color.font.primary} output changes so that it does not include the resolved previous reference.

Expected output:

  --color-font-primary: #000000;
  --color-font-secondary: #2c2c2c;
  --color-font-tertiary: #555555;

Actual output:

  --color-font-primary: #000000;
  --color-font-secondary: #2c2c2c;
  --color-font-tertiary: #2c2c2c;

six7 avatar Mar 13 '22 12:03 six7

Another example:

    "fontFamilies": {
      "open-sans": {
        "value": "Open Sans",
        "type": "fontFamilies"
      }
    },
...
  "H1": {
      "fontFamily": {
        "value": "$fontFamilies.open-sans",
        "type": "fontFamily"
      },
...

Output:

$font-families-open-sans: Open Sans;
$h1-font-family: $fontFamilies.open-sans;
$h1-font-weight: $fontWeights.open-sans-0;
$h1-line-height: $lineHeights.0;
...

Sebazzz avatar Mar 14 '22 12:03 Sebazzz

Looks like this issue has been fixed for a bit. Closing for now, please re-open if the issue is still occurring.

dbanksdesign avatar Sep 25 '22 21:09 dbanksdesign