0.6.1 • Published 7 years ago

px2rem-dpr v0.6.1

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

px2rem-dpr

px2rem

declaration

add new options

  • shouldUseDprRule : Function(declaration); // 该属性是否使用dpr规则设置px样式
  • shouldIgnoreRule : Function(declaration); // 该属性是否忽略rem转换

example

优先使用px2rem的comment规则,如果没有comment,使用shouldUseDprRule和shouldIgnoreRule

{
  baseDpr: 2,             // base device pixel ratio (default: 2)
  remUnit: 75,            // rem unit value (default: 75)
  remPrecision: 6,        // rem value precision (default: 6)
  forcePxComment: 'px',   // force px comment (default: `px`)
  keepComment: 'no',       // no transform value comment (default: `no`)
  shouldUseDprRule: function(rule){
    var list = ['font', 'font-size'];
    return list.some(function(item) {
      return item === rule.property;
    })
  },
  shouldIgnoreRule: function(rule) {
    return  /border/.test(rule.property);
  }
}