You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
406 B
JavaScript

'use strict';
var postcss = require('postcss');
var Px2rem = require('px2rem');
module.exports = postcss.plugin('postcss-px2rem', function (options) {
return function (css, result) {
var oldCssText = css.toString();
var px2remIns = new Px2rem(options);
var newCssText = px2remIns.generateRem(oldCssText);
var newCssObj = postcss.parse(newCssText);
result.root = newCssObj;
};
});