mikaelvesavuori / figmagic

Figmagic is the missing piece between DevOps and design: Generate design tokens, export graphics, and extract design token-driven React components from your Figma documents.
https://docs.figmagic.com
MIT License
807 stars 71 forks source link

Invalid JavaScript when using tokens for CSS with camelizeTokenNames set to false #153

Closed glouhaichi closed 2 years ago

glouhaichi commented 2 years ago

When setting the camelizeTokenNames option to false, the tokens are imported correctly without transformation. However, their use inside the elements' JS files presents invalid JavaScript, because it is using dot notation instead of bracket notation to call the tokens that have dashes in them.

Current import (dot notation)

const IxcCogniraButtonPrimaryLargeIconHoverCss = `
color: ${colors.ixc-cognira-color-primary-100};
font-size: ${fontSizes.ixc-cognira-headline-08};
`;

Correct import (bracket notation)

const IxcCogniraButtonPrimaryLargeIconHoverCss = `
color: ${colors["ixc-cognira-color-primary-100"]};
font-size: ${fontSizes["ixc-cognira-headline-08"]};
`;
mikaelvesavuori commented 2 years ago

This is now the default in version 4.4.1.