cuth / postcss-pxtorem

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

Add property blacklist #28

Closed sndrs closed 7 years ago

sndrs commented 8 years ago

Adds a propBlackList (ref #25).

Leaves the propWhiteList behaviour intact, but the propBlackList will override it:

// margin is ignored
{
  propWhiteList: ['margin', 'height'],
  propBlackList: ['margin']
} 

// only margin is ignored
{
  propWhiteList: [],
  propBlackList: ['margin']
} 

// margin is ignored (would be anyway), defaults are transformed
{
  propBlackList: ['margin']
} 

// font is ignored, only other defaults are transformed
{
  propBlackList: ['font']
} 
cuth commented 8 years ago

I see how this is powerful but it might be a little confusing for people since propWhiteList has default properties.

How about something like this:

{
  propList: ['~font', 'line-height', 'letter-spacing']
}

This would be the same as the current defaults. ~ allows "font" to match "font-size"

{
  propList: ['~margin', '!margin-left']
}

Match all "margin" properties expect "margin-left"

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

Match everything except all "border" properties

{
  propList: []
}

Still match everything

Support propWhiteList -> propList for legacy.

cuth commented 8 years ago

Added PR #29