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

Fix typography token aliases in plugin-css #192

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Conversation

drwpow
Copy link
Collaborator

@drwpow drwpow commented Feb 14, 2024

Changes

Fixes #191.

How to Review

Tests should pass!

Copy link

changeset-bot bot commented Feb 14, 2024

🦋 Changeset detected

Latest commit: 9ee834e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cobalt-ui/plugin-css Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9ee834e
Status: ✅  Deploy successful!
Preview URL: https://4428d854.cobalt-ui.pages.dev
Branch Preview URL: https://fix-typography-tokens.cobalt-ui.pages.dev

View logs

@@ -45,6 +45,16 @@ describe('5. Group', () => {
});

describe('7. Alias', () => {
test('top-level', () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just paranoia, but I wanted to add a test that referencing an alias without any . in it worked. I just realized that’s untested. Fortunately that was unrelated to #191

@@ -117,8 +117,12 @@ export default function pluginCSS(options?: Options): Plugin {
break;
}
case 'typography': {
for (const [k, v] of Object.entries(value)) {
tokenVals[generateName(`${token.id}-${k}`, token)] = v;
if (value && typeof value === 'object') {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple fix: typography tokens get “hoisted” (for lack of a better term) in plugin-css, but in some instances this has already been transformed to a CSS variable (a string).

@@ -69,6 +69,9 @@
"width": "1px",
"style": "solid"
}
},
"default": {
"$value": "{border.solid}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also tested border and gradient tokens to make sure it wasn’t happening with other composite types

@drwpow drwpow merged commit edd33ef into main Feb 14, 2024
10 checks passed
@drwpow drwpow deleted the fix-typography-tokens branch February 14, 2024 04:55
@github-actions github-actions bot mentioned this pull request Feb 14, 2024
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 this pull request may close these issues.

Possible bug in plugin-css with typography tokens
1 participant