Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.11 KB

README.md

File metadata and controls

51 lines (36 loc) · 1.11 KB

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