如何在样式字典(amzn)中的设计标记输出中添加更多单位类型(px,rem)

问题描述 投票:0回答:1

你们都知道,如果我们在

config.json
中使用
"transformGroup": "scss"
进行配置,则大小将隐含为
rem
单位

{
  "source": ["src/styledictionary/tokens/**/*.json"],
  "platforms": {
    "scss": {
      "transformGroup": "scss",
      "buildPath": "src/styles/tokens/",
      "files": [{
        "destination": "_variables.scss",
        "format": "scss/variables"
      }]
    }
  }
}

但我希望某些令牌在同一个 json 文件中具有

px
单位,例如:

{
  "size": {
    "font": {
      "xss"  : { "value": "0.66" },
      "xs"  : { "value": "0.85" },
      "s" : { "value": "1" },
      "m": { "value": "1.14" },
      "l" : { "value": "1.43" },
      "xl"    : { "value": "1.71" },
      "xxl"   : { "value": "2.29" },
      "base"  : { "value": "14px"}
    }
  }
}

我想要一个

base font size = 14px
并且其他变体有
rem
单位,那么如果我运行
style dictionary build
我得到了所有的
rem
单位,但
$size-font-base: 14rem;
应该是
$size-font-base: 14px;

我试图找到此配置文件,但找不到,请帮助我! 非常感谢你们!!


// Do not edit directly
// Generated on Wed, 03 Jan 2024 10:40:20 GMT

$size-font-xss: 0.66rem;
$size-font-xs: 0.85rem;
$size-font-s: 1rem;
$size-font-m: 1.14rem;
$size-font-l: 1.43rem;
$size-font-xl: 1.71rem;
$size-font-xxl: 2.29rem;
$size-font-base: 14rem;

sass frontend token style-dictionary design-tokens
1个回答
0
投票

您找到如何做的答案了吗?

© www.soinside.com 2019 - 2024. All rights reserved.