2rem

1.0.13 • Public • Published

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.

Package Sidebar

Install

npm i 2rem

Weekly Downloads

16

Version

1.0.13

License

ISC

Unpacked Size

2.77 kB

Total Files

3

Last publish

Collaborators

  • lore-w