-
Notifications
You must be signed in to change notification settings - Fork 29
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
Conversation
🦋 Changeset detectedLatest commit: 9ee834e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Deploying with Cloudflare Pages
|
@@ -45,6 +45,16 @@ describe('5. Group', () => { | |||
}); | |||
|
|||
describe('7. Alias', () => { | |||
test('top-level', () => { |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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}" |
There was a problem hiding this comment.
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
Changes
Fixes #191.
How to Review
Tests should pass!