design-token-transformer icon indicating copy to clipboard operation
design-token-transformer copied to clipboard

npm run transform-tokens cant find "global" form figma plugin export

Open TBrayner opened this issue 3 years ago • 1 comments
trafficstars

"Reference doesn't exist: global.color.primary-base.value tries to reference brand.accenture.primary-base, which is not defined"

Once the figma Plugin creates this "Global" key, the token-transformer can't find it, I'm including it manually

image

to this:

image

{
  "global": {
    "brand": {
      "accenture": {
        "primary-base": {
          "value": "#A100FF",
          "type": "color",
          "description": "Base Accenture Color"
        },
        "secondary": {
          "value": "#0041F0",
          "type": "color"
        }
      }
    },
    "color": {
      "primary-base": {
        "value": "{brand.accenture.primary-base}",
        "type": "color"
      }
    },
    "black": {
      "12": {
        "value": "rgba(0,0,0,0.12)",
        "type": "color"
      },
      "25": {
        "value": "rgba(0,0,0,0.25)",
        "type": "color"
      },
      "50": {
        "value": "rgba(0,0,0,0.5)",
        "type": "color"
      },
      "85": {
        "value": "rgba(0,0,0,0.85)",
        "type": "color"
      },
      "100": {
        "value": "#000",
        "type": "color"
      }
    }
  },
  "font": {},
  "$themes": [],
  "$metadata": {
    "tokenSetOrder": [
      "global",
      "font"
    ]
  }
}

TBrayner avatar Oct 22 '22 03:10 TBrayner

Hey @TBrayner,

the plugin does not by itself include a global key. This must be your to level in figma. Is that correct?

You need to write the entire path out in the references. I hope that helps, otherwise please clarify the question.

lukasoppermann avatar Oct 23 '22 05:10 lukasoppermann