Browse Source

Update index.js

pull/14/head
msidolphin 7 years ago
committed by GitHub
parent
commit
fff029b368
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      index.js

8
index.js

@ -31,6 +31,14 @@ module.exports = postcss.plugin('postcss-px-to-viewport', function (options) {
return function (css) {
css.walkDecls(function (decl, i) {
if (opts.exclude) {
if (Object.prototype.toString.call(opts.exclude) !== '[object RegExp]') {
throw new Error('options.exclude should be RegExp!')
}
if (decl.source.input.file.match(opts.exclude) !== null) return;
}
// This should be the fastest test and will remove most declarations
if (decl.value.indexOf(opts.unitToConvert) === -1) return;

Loading…
Cancel
Save