1.0.3 • Published 7 years ago
fis-packager-rem v1.0.3
fis-packager-rem
fis3 对px单位的css属性自动转化为rem为单位的fis插件。基于rem的解决方案rem-core的二次开发。
- 使用node-css把css解析后,对px为单位对属性进行rem转换处理。
- 对文字进行特殊处理追加至产出的css文件之后。
- developer只用专注开发,配置灵活方便, 对原始文件无侵入。
flexible.js
默认可以配合淘宝的flexible.js使用
fis配置
fis.match('*.css', {
parser: fis.plugin('rem', {
dpr: 2,
rem: 750,
// 需要过滤的css样式属性关键字
exclude: ['background-size'],
// 需要过滤的css文件路径关键字
excludeFile: ['common']
})
})
Usage
body {
border-top: 1px;
border-bottom: 10px;
padding: 10px; /* @norem */
background-size: 10px 10px;
}
输出:
body {
border-top: 1px;
border-bottom: 0.5557rem;
padding: 10px;
background-size: 0.5557rem 0.5557rem;
}