1.0.13 • Published 6 years ago

2rem v1.0.13

Weekly downloads
35
License
ISC
Repository
github
Last release
6 years ago

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: 50
  • mini number default: 1 (if one px value <= mini you set will not to be converted)

LICENSE

MIT.