amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.93k stars 557 forks source link

size/pxToRem does not work as shown #925

Closed yashiel closed 1 year ago

yashiel commented 1 year ago

this is my transform code

css: {
    basePxFontSize: 14,
    transforms: [
        'attribute/cti',
        'name/cti/kebab',
        'time/seconds',
        'content/icon',
        'size/pxToRem',
        'color/css',
    ],
    files: [
        {
            destination: 'build/css/variables.css',
            format: 'css/variables',
        },
    ],
    output: true,
},

token file

{
  "Tokens": {
    "spacing": {
      "2": {
        "value": "2px",
        "type": "spacing",
        "description": "space-2"
      },
   },
 },
}

but this doesn't transform px to rem, can someone please tell me why it's happening, pixel values stay the same

yashiel commented 1 year ago

i've made custom transformer to convert font-sizes to rem now its all okay