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

Possible bug in plugin-css with typography tokens #191

Closed
torstendaeges opened this issue Feb 8, 2024 · 3 comments · Fixed by #192
Closed

Possible bug in plugin-css with typography tokens #191

torstendaeges opened this issue Feb 8, 2024 · 3 comments · Fixed by #192

Comments

@torstendaeges
Copy link

torstendaeges commented Feb 8, 2024

Hello,

I came across an issue with typography tokens today:

So "d.font.display" is an alias for the base typography token "o.font.10".
Both are $type typography.

For some reason, the output of plugin-css breaks up the reference "var(--o-font-10)" letter by letter.

  --d-font-display-0: v;
  --d-font-display-1: a;
  --d-font-display-2: r;
  --d-font-display-3: (;
  --d-font-display-4: `-;`
  --d-font-display-5: -;
  --d-font-display-6: o;
  --d-font-display-7: -;
  --d-font-display-8: f;
  --d-font-display-9: o;
  --d-font-display-10: n;
  --d-font-display-11: t;
  --d-font-display-12: -;
  --d-font-display-13: 1;
  --d-font-display-14: 0;
  --d-font-display-15: );

The same happens to all my typography tokens.

Is this a known bug? Thank you and keep up the amazing work!
Torsten

@torstendaeges
Copy link
Author

Here's an input JSON the bug can be replicated with - the token "fontalias" gets transformed into 15 css custom properties.

{
  "bodyText": {
    "$type": "typography",
    "$value": {
      "fontFamily": ["Helvetica", "-system-ui", "sans-serif"],
      "fontSize": "1.5rem",
      "fontStyle": "normal",
      "fontWeight": 400,
      "letterSpacing": 0,
      "lineHeight": 1.5,
      "textTransform": "none"
    }
  },
  "fontalias": {
    "$type": "typography",
    "$value": "{bodyText}"
  }
}

@drwpow
Copy link
Collaborator

drwpow commented Feb 14, 2024

Awesome bug report, and great recreation! Found the issue very easily, and will be pushing a fix to @cobalt-ui/plugin-css. As far as I can tell, this is only a bug in the CSS plugin, but please let me know if it crops up again 🙂

@torstendaeges
Copy link
Author

Thank you so much for the quick fix! However, I'm afraid the issue is still popping up in mode-output. Since I can't reopen this one, I'm opening a new issue for it - hope that's ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants