is there way to convert measurement to rem? #194
-
My config file is this.
maybe origin measurement values is different with fontSize. is there any way to apply px-to-rem parser? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @toy-crane 👋 Thanks for your patience. Yes you can convert your text styles and your measurement tokens in rem with the px-to-rem parser. Your config currently asks Specify to generate both your text styles and your measurement tokens in a However, the px-to-rem parser can only convert one token type at a time. Here's your updated configuration: {
"repository": "@onthelook/design-system",
"head": "specify",
"base": "main",
"rules": [
{
"name": "Design Tokens / Text Styles",
"path": "textStyles.json",
"filter": {
"types": [
"textStyle"
]
},
"parsers": [
{
"name": "px-to-rem",
"options": {
"keys": ["fontSize", "lineHeight"]
}
}
]
},
{
"name": "Design Tokens / Measurements",
"path": "measurements.json",
"filter": {
"types": [
"measurement"
]
},
"parsers": [
{
"name": "px-to-rem",
"options": {
"keys": ["value"]
}
}
]
}
]
} This config file generates 2 files:
Please let me know if things are working well on your side ;) |
Beta Was this translation helpful? Give feedback.
Hi @toy-crane 👋
Thanks for your patience.
Yes you can convert your text styles and your measurement tokens in rem with the px-to-rem parser.
Your config currently asks Specify to generate both your text styles and your measurement tokens in a
textStyles.json
file.However, the px-to-rem parser can only convert one token type at a time.
Here's your updated configuration: