-
Notifications
You must be signed in to change notification settings - Fork 31
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@cobalt-ui/plugin-css": patch | ||
--- | ||
|
||
Fix typography token aliases |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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). |
||
for (const [k, v] of Object.entries(value)) { | ||
tokenVals[generateName(`${token.id}-${k}`, token)] = v; | ||
} | ||
} else { | ||
tokenVals[ref] = value; | ||
} | ||
break; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Also tested |
||
} | ||
} | ||
} |
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