px2rem-dpr
v0.6.1
Published
According to one stylesheet, generate rem version and @1x, @2x and @3x stylesheet
Downloads
12
Readme
px2rem-dpr
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);
}
}