fis px自动转化成rem插件
JavaScript
Latest commit 2486ca0 Aug 26, 2016 @feix760 feix760 committed on GitHub Merge pull request #4 from cecilpeng/master
优化正则匹配速度
Permalink
Failed to load latest commit information.
.gitignore add src Apr 8, 2016
README.md add src Apr 8, 2016
index.js
package.json add src Apr 8, 2016

README.md

fis-parser-rem

fis px自动转化成rem插件

fis.conf

CSS

fis.match('*.css', {
    parser: [ 
        fis.plugin('rem')
    ]
})

SCSS

fis.match('*.scss', {
    rExt: '.css',
    parser: [ 
        fis.plugin('node-sass'),
        fis.plugin('rem')
    ]
})

Usage

body {
    border-top: 1px;
    border-bottom: 10px;
    padding: 10px; /* @norem */
    background-size: 10px 10px; /* @rem */
}

输出:

body {
    border-top: 1px;
    border-bottom: 0.5557rem;
    padding: 10px;
    background-size: 0.5557rem 0.5557rem;
}

Option

  • rem {Number} 1rem=多少px default 18
  • min {Number} 最小转化值 default 3
  • exclude {Array.<String>} 忽略的样式 default ['width', 'height', 'background', 'background-size']

Question

  • 如何忽略整个文件? 在文件头添加/* @norem */即可