lukasoppermann / design-tokens

🎨 Figma plugin to export design tokens to json in an amazon style dictionary compatible format.
https://www.figma.com/community/plugin/888356646278934516/Design-Tokens
MIT License
924 stars 123 forks source link

Reference tokens not correct #293

Open reivaxui opened 7 months ago

reivaxui commented 7 months ago

Hi, When I generate json tokens, the references are incorrect.

Example : I have 3 modes "Theme A", "Theme B", "Theme C". Each value reference take the last mode (theme C)

"value": "{colors.themeC.palette.brand.secondary}" Reference value must be {colors.themeA.palette.brand.secondary}

  "colors": {
    "themeA": {
      "palette": {
        "brand": {
          "primary": {
            "type": "color",
            "value": "#001944ff",
            "blendMode": "normal"
          }
        }
      },
      "surfaces": {
        "primary": {
          "default": {
            "type": "color",
            "value": "{colors.themeC.palette.brand.secondary}"
          }
        }
      }
    },
    "themeB": {
      "palette": {
        "brand": {
          "primary": {
            "type": "color",
            "value": "#001944ff",
            "blendMode": "normal"
          }
        }
      },
      "surfaces": {
        "primary": {
          "default": {
            "type": "color",
            "value": "{colors.themeC.palette.brand.secondary}"
          }
        }
      }
    },
    "themeC": {
      "palette": {
        "brand": {
          "primary": {
            "type": "color",
            "value": "#001944ff",
            "blendMode": "normal"
          }
        }
      },
      "surfaces": {
        "primary": {
          "default": {
            "type": "color",
            "value": "{colors.themeC.palette.brand.secondary}"
          }
        }
      }
    }
  }
JackHowa commented 7 months ago

I'm seeing this as well

Franjoo commented 6 months ago

Yes, it would be really nice if that could be fixed.

Franjoo commented 1 week ago

Any updates here?

JulianBissekkou commented 6 days ago

I can also reproduce this. This sadly makes the plugin unusable :/

lukasoppermann commented 6 days ago

Sorry I missed this. I will loom into the Pr by @JackHowa to merge it

lukasoppermann commented 5 days ago

Hey, I looked into it but it is not as easy as you made it seem. 🤣

@JackHowa can you please just add the needed test to the PR you made? https://github.com/lukasoppermann/design-tokens/pull/289

Only the test please. Happy to look into the other PR you closed as a separate one. But I would love the PR to stay as it is and just add a test so I don't have to re-review and can merge it as soon as the test is there. 🙏

JackHowa commented 5 days ago

here's the tests! https://github.com/lukasoppermann/design-tokens/pull/300/files#diff-e837ef5c10534f796d3fb7ce69273c9fc247852124c1ea52c0eed956756c9281

JackHowa commented 5 days ago

ah I didn't make that pr linked https://github.com/lukasoppermann/design-tokens/pull/289 but I can see if I can make a clean pr for ya

JackHowa commented 5 days ago

here's the updated pr https://github.com/lukasoppermann/design-tokens/pull/300. I had to break out some utils so they were easier to test

lukasoppermann commented 3 days ago

Okay, I merged and released this now. Can you please test if this fixes it?

JackHowa commented 3 days ago

Okay, I merged and released this now. Can you please test if this fixes it?

Yep works for me!