cuth / postcss-pxtorem

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

Change propWhiteList to propList #29

Closed cuth closed 7 years ago

cuth commented 7 years ago

This is a PR to change propWhiteList to propList.

This would solve issue #1 by allowing strings to match the beginning, end or anywhere in the prop.

{
  propList: ['^margin', '~border', '$-top']
}

This would solve issue #25 by allowing wildcard and "not" selectors.

{
  propList: ['*', '!~border']
}

New option description: propList (Array) The properties that can change from px to rem.

propWhiteList will map to propList for legacy support.

sndrs commented 7 years ago

what do you think about using * more generally, instead of ~, ^ and $? so that:

['*position*'] => ['~position'] ['font*'] => ['^font'] ['*-radius'] => ['$-radius']

cuth commented 7 years ago

@sndrs, I think you are right. That is easier to understand.

awcross commented 7 years ago

+1

jieyou commented 7 years ago

@cuth , Thanks for your wonderful plugin. As talked above, when can you modify the signs to @sndrs 's suggestion and merge the PR to master? It's very useful to my project that I want almost every length props can be auto translate to REM Thanks again!

sndrs commented 7 years ago

❤️ 😃