2rem 中文文档教程
2rem
中的 px
转换为 rem
。
Usage
Gulp
var gulp = require('gulp');
var postcss = require('postcss');
var toRem = require('2rem');
gulp.task('css', function() {
var processors = [
toRem({
base: 100,
mini: 1
})];
return gulp.src('./src/*.css')
.pipe(postcss(processors))
.pipe(gulp.dest('./dest'));
});
Input
#demo {
width: 100px;
height: 200px;
border: 1px solid #fafafa;
}
Output
#demo {
width: 1rem;
height: 2rem;
border: 1px solid #fafafa;
}
Options
base
number default: 50mini
number default: 1 (if onepx
value<=
mini you set will not to be converted)
LICENSE
2rem 是一个 postcss 插件,可以将你的 css MIT
2rem
2rem is a postcss plugin that convert px
to rem
in your css
Usage
Gulp
var gulp = require('gulp');
var postcss = require('postcss');
var toRem = require('2rem');
gulp.task('css', function() {
var processors = [
toRem({
base: 100,
mini: 1
})];
return gulp.src('./src/*.css')
.pipe(postcss(processors))
.pipe(gulp.dest('./dest'));
});
Input
#demo {
width: 100px;
height: 200px;
border: 1px solid #fafafa;
}
Output
#demo {
width: 1rem;
height: 2rem;
border: 1px solid #fafafa;
}
Options
base
number default: 50mini
number default: 1 (if onepx
value<=
mini you set will not to be converted)
LICENSE
MIT.