Theo到SCSS
#javascript #css #sass #scss

您可能具有以下单的JSON文件,该文件称为plasmic-tokens.theo.json

{
  "props": [
    {
      "name": "96",
      "type": "spacing",
      "value": "24rem",
      "category": "spacing",
      "meta": {
        "projectId": "…",
        "id": "…"
      }
    },
    {
      "name": "Black-050",
      "type": "color",
      "value": "#F6F7F7",
      "category": "color",
      "meta": {
        "projectId": "…",
        "id": "…"
      }
    },
    …
  ]
}

这是文件已被Salesforce theo烤制。

如果要提取SASS的颜色,则可以使用命令行工具:

yarn theo app/javascript/plasmic-tokens.theo.json --transform web --format sass

,或者如果在我的情况下(Cannot find module 'optimist')不起作用,请使用以下单线提取所有颜色:

jq -r '.props[] | select(.type == "color") | "$" + .name + ": " + .value + ";"' app/javascript/components/plasmic-tokens.theo.json | tr '[:upper:]' '[:lower:]'