Skip to content

A Rework plugin to add pixel fallback for properties using rem units.

License

Notifications You must be signed in to change notification settings

ctalkington/rework-rem-fallback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Rework plugin to add pixel fallback for properties using rem units.

Resources

License

Stars

Watchers

Forks

Packages

No packages published