cuth / postcss-pxtorem

Convert pixel units to rem (root em) units using PostCSS
MIT License
2.03k stars 174 forks source link

propWhiteList is not working for me #30

Closed alexpi closed 7 years ago

alexpi commented 7 years ago

Hello,

My issue is that pxtorem converts only font-related properties to rem, as stated in the docs. I am using the propWhiteList to add for example margin and padding, but I get px values.

I am using a postcss.json file for my config:

{
  "use": ["postcss-import",
        "autoprefixer",
        "postcss-pxtorem",
        "postcss-simple-vars",
        "postcss-extend",
        "postcss-nested",
        "postcss-flexbugs-fixes"
     ],
  "css-import": {
    "from": "src/css/"
  },
    "autoprefixer": {
      "browsers": "> 5%"
  },
    "pxtorem": {
        "rootValue": 16,
        "unitPrecision": 5,
        "propWhiteList": ["margin", "padding"],
        "selectorBlackList": [],
        "replace": true,
        "mediaQuery": true
    }
}

Any ideas?

cuth commented 7 years ago

I've never used a postcss.json file so I can't tell if you've used the correct syntax there.

As for the postcss-pxtorem options: You've only included "margin" and "padding" in the propWhiteList so only those two properties will be converted. This does not include "margin-left" or "font-size" as you've have to add those as well.

freonirons409 commented 7 years ago

Same here, doesnt convert margins or padding or anything but fonts even if I specificy margin-top, margin-left, padding-left, etc.

cuth commented 7 years ago

@freonirons409, I'll fix if you provide a failing test.

cuth commented 7 years ago

Version 4.0.0 changes how propList works.