diff --git a/index.js b/index.js index 19548cc..bba6080 100644 --- a/index.js +++ b/index.js @@ -109,7 +109,7 @@ module.exports = function (html, styles, options) { if (o.ignore) { links = _.filter(links, link => { const href = $(link).attr('href'); - return _.findIndex(options.ignore, arg => { + return _.findIndex(o.ignore, arg => { return (_.isRegExp(arg) && arg.test(href)) || arg === href; }) === -1; }); diff --git a/test/index.js b/test/index.js index c687dec..7512ae5 100644 --- a/test/index.js +++ b/test/index.js @@ -168,7 +168,7 @@ describe('Module: inline-critical', function () { done(); }); - it('should respect ignore option with string', function (done) { + it('should respect ignore option with string array', function (done) { function strip2(string) { return string.replace(/\s+/gm, ''); } @@ -181,7 +181,22 @@ describe('Module: inline-critical', function () { expect(strip2(out.toString('utf-8'))).to.be.equal(strip2(expected)); done(); }); - it('should respect ignore option with RegExp', function (done) { + + it('should respect single ignore option with string', function (done) { + function strip2(string) { + return string.replace(/\s+/gm, ''); + } + + var html = read('test/fixtures/external.html'); + var expected = read('test/expected/external-ignore-expected.html'); + var css = read('test/fixtures/critical.css'); + var out = inlineCritical(html, css, {minify: false, ignore: 'bower_components/bootstrap/dist/css/bootstrap.css'}); + + expect(strip2(out.toString('utf-8'))).to.be.equal(strip2(expected)); + done(); + }); + + it('should respect ignore option with RegExp array', function (done) { function strip2(string) { return string.replace(/\s+/gm, ''); }