Comparing version 2.1.2 to 2.2.0
@@ -6,2 +6,3 @@ 'use strict'; | ||
var Detector = require('./detect-feature-use'); | ||
var Multimatch = require('multimatch'); | ||
@@ -12,2 +13,3 @@ function doiuse(options) { | ||
var ignore = options.ignore; | ||
var ignoreFiles = options.ignoreFiles; | ||
@@ -42,2 +44,6 @@ if (!browserQuery) { | ||
if (ignoreFiles && Multimatch(usage.source.input.from, ignoreFiles).length > 0) { | ||
return; | ||
} | ||
var message = features[feature].title + ' not supported by: ' + features[feature].missing + ' (' + feature + ')'; | ||
@@ -44,0 +50,0 @@ |
{ | ||
"name": "doiuse", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "Lint CSS for browser support against caniuse database.", | ||
@@ -37,2 +37,3 @@ "main": "lib/doiuse.js", | ||
"lodash": "^3.5.0", | ||
"multimatch": "^2.0.0", | ||
"postcss": "^5.0.8", | ||
@@ -45,2 +46,3 @@ "source-map": "^0.4.2", | ||
"babel": "^5.2.13", | ||
"postcss-import": "^7.1.3", | ||
"standard": "^4.3.1", | ||
@@ -47,0 +49,0 @@ "tape": "^4.0.0" |
@@ -60,2 +60,3 @@ [![Build Status](https://travis-ci.org/anandthakker/doiuse.svg?branch=master)](https://travis-ci.org/anandthakker/doiuse) | ||
ignore: ['rem'], // an optional array of features to ignore | ||
ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore | ||
onFeatureUsage: function(usageInfo) { | ||
@@ -82,2 +83,3 @@ console.log(usageInfo.message); | ||
ignore: ['rem'], // an optional array of features to ignore | ||
ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore | ||
onFeatureUsage: function (usageInfo) { | ||
@@ -122,2 +124,3 @@ console.log(usageInfo.message) | ||
ignore: ['rem'], // an optional array of features to ignore | ||
ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore | ||
onFeatureUsage: function(usageInfo) { } // a callback for usages of features not supported by the selected browsers | ||
@@ -124,0 +127,0 @@ } |
@@ -5,2 +5,3 @@ var fs = require('fs') | ||
var doiuse = require('../') | ||
var atImport = require('postcss-import') | ||
var hasKeys = require('./has-keys') | ||
@@ -60,1 +61,51 @@ | ||
}) | ||
test('ignores specified files and calls back for others', function (t) { | ||
var run, ignoreCss, processCss, pcss | ||
ignoreCss = fs.readFileSync(require.resolve('./cases/ignore-file.css')) | ||
processCss = fs.readFileSync(require.resolve('./cases/gradient.css')) | ||
run = false | ||
pcss = function () { | ||
return postcss(doiuse({ | ||
browsers: ['ie 6'], | ||
ignoreFiles: ['**/ignore-file.css'], | ||
onFeatureUsage: function (usageInfo) { | ||
run = true | ||
} | ||
})) | ||
} | ||
pcss().process(ignoreCss, {from: './cases/ignore-file.css'}) | ||
.then(function () { | ||
t.false(run, 'should be false') | ||
}) | ||
.then(function () { | ||
return pcss().process(processCss, {from: './cases/gradient.css'}) | ||
}) | ||
.then(function () { | ||
t.true(run, 'should be true') | ||
t.end() | ||
}) | ||
}) | ||
test('ignores rules from some imported files, and not others', function (t) { | ||
var count, css, cssPath | ||
cssPath = require.resolve('./cases/ignore-import.css') | ||
css = fs.readFileSync(cssPath) | ||
count = 0 | ||
postcss([atImport(), | ||
doiuse({ | ||
browsers: ['ie 6'], | ||
ignoreFiles: ['**/ignore-file.css'], | ||
onFeatureUsage: function (usageInfo) { | ||
count++ | ||
} | ||
})]) | ||
.process(css, {from: cssPath}) | ||
.then(function () { | ||
t.equal(count, 2) | ||
t.end() | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61182
70
1704
159
12
4
+ Addedmultimatch@^2.0.0
+ Addedarray-differ@1.0.0(transitive)
+ Addedarray-union@1.0.2(transitive)
+ Addedarray-uniq@1.0.3(transitive)
+ Addedarrify@1.0.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedmultimatch@2.1.0(transitive)