rework-rem-fallback

Add pixel fallback to CSS rules using rem units

npm install rework-rem-fallback
2 downloads in the last week
5 downloads in the last month

rework-rem-fallback Build Status

A Rework plugin to add pixel fallback for properties using rem units. This is a build time workaround for browsers that don't understand the rem unit. (cough IE<9)

Installation

npm install rework-rem-fallback

Use

As a Rework plugin:

// dependencies
var fs = require('fs');
var rework = require('rework');
var remFallback = require('rework-rem-fallback');

// css to be processed
var css = fs.readFileSync('build/build.css', 'utf8').toString();

// process css using rework-rem-fallback (default base 16px)
var out = rework(css).use(remFallback()).toString();

// process css using rework-rem-fallback (custom base 14px)
var out14 = rework(css).use(remFallback(14)).toString();

Output

.main-header {
  width: 5rem;
}

yields:

.main-header {
  width: 80px;
  width: 5rem;
}

License

MIT License

npm loves you