Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Combination of expand: { typography: false } & outputReferences causes CSS-vars formatting to break #209

Closed
LorenzKahl opened this issue Oct 18, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@LorenzKahl
Copy link

What happened?

When transforming tokens coming from the Tokens Studio plugin, we are running into problems with the combination of:
expand: { typography: false } & outputReferences

I'm just guessing, but it seems to be related to the token name containing the character 0 (zero) when being used within a reference.

{
  "Font": {
    "LineHeight": {
      "10": { // <- this is causing the problems when being referenced ❌ 
        "value": "10",
        "type": "lineHeights"
      },
      "11": { // <- this is fine ✅
        "value": "11",
        "type": "lineHeights"
      }
   }
   "Headline": {
      "L-XL": {
        "Large": {
            "value": {
            ...
            "lineHeight": "{Font.LineHeight.10}",  // <- this will result in a broken output ❌ 
            ...
          },
          "type": "typography"
        },

Reproduction

https://configurator.tokens.studio/#project=7VjNbuM2EH6VgdEizkKW4j304HSLFgmCFMgCi03QLVAHXVqiLW4kUiCpxK6hY299hPbl9knKH8miaFlZB0Uv7c3mfPPNN8PhSNR2xPGKCIn57eVVSWNJGBXhJzGajUheMC7hVm4yfEmMBfENLDnL4UTo1UmyWz45n9PaYQsN5R1HVCwZzwVUtd/3kj1gKiZClglhkUgmcgfSHHMaRdBZDeA1TaBAHOVYcYJaBFYYnRAjCgsMKElwYjxvMYaExWIGqZSFmEXRisi0XIQxy6OB0HO6r3nsZR7Adk4B8LpANJmpNOWmYCuOinQzgyXKBA5ApChhT/VfqII5rU6brPAa5UWG4RFlJYZd7ACeUhKn8KkUUlVOllwlJlOF0HIBCSBKnqcl3JM7NuKUJDyD+cjEmI8CvUZV4fRavrlQIVi+c6ntOZJxivkMxibiKbz5DraVMe1E+mZthFqtFXoOKsVvJ5PWR0unGJutAah0KepKaCuSkOKswFzYzvAbak5jtcO6m5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8DBqrV79B7yPqa3vvc9G/XGiS5OqvuwOyZhffesRxVfwM=

Expected output

  --sd-font-headline-l-xl-large: var(--sd-font-weight-arial-company-headline-regular) var(--sd-font-size-10)/var(--sd-font-line-height-10) var(--sd-font-family-arial-company-headline);

Version

^0.11.6

@LorenzKahl LorenzKahl added the bug Something isn't working label Oct 18, 2023
@jorenbroekema
Copy link
Member

Hey, this is related to outputReferences in general not working very well. I did actually improve outputReferences in style-dictionary very recently, I'll talk with the other maintainer to see if we can do a release of style-dictionary v3, then I have to do a subsequent patch of browser-style-dictionary patch, and then I expect this use case to work better.

See also:
#121
amzn/style-dictionary#974

Closing this, as it is essentially a duplicate of #121 which will remain open until we do the v3 release and browser-style-dictionary patch as well, so best to track that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants