diff --git a/lib/filter.js b/lib/filter.js index f5f03fb..20a021f 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -16,9 +16,9 @@ function logicHtml (str, data) { let path = data.path let exclude = options.exclude - // Return if a path matches exclusion pattern + // Return if a path matches exclusion pattern if (path && exclude && exclude.length) { - if (nanomatch.some(path, exclude, { matchBase: true })) return str + if (nanomatch.some(path, exclude, { matchBase: true })) return str } let result = Htmlminifier(str, options) @@ -39,9 +39,9 @@ function logicCss (str, data) { let path = data.path let exclude = options.exclude - // Return if a path matches exclusion pattern + // Return if a path matches exclusion pattern if (path && exclude && exclude.length) { - if (nanomatch.some(path, exclude, { matchBase: true })) return str + if (nanomatch.some(path, exclude, { matchBase: true })) return str } return new Promise(function (resolve, reject) { @@ -66,13 +66,13 @@ function logicJs (str, data) { let path = data.path let exclude = options.exclude - // Return if a path matches exclusion pattern + // Return if a path matches exclusion pattern if (path && exclude && exclude.length) { - if (nanomatch.some(path, exclude, { matchBase: true })) return str + if (nanomatch.some(path, exclude, { matchBase: true })) return str } // Terser doesn't like unsupported options - const jsOptions = Object.assign({}, options) + const jsOptions = Object.assign({}, options) delete jsOptions.enable delete jsOptions.exclude delete jsOptions.logger @@ -96,9 +96,9 @@ function logicGzip () { let routeList = route.list() return Promise.all(routeList.filter(path => (path.endsWith('.html') || path.endsWith('.js') || path.endsWith('.css') - || path.endsWith('.xml') || path.endsWith('.json') || path.endsWith('.txt') - || path.endsWith('.ttf') || path.endsWith('.atom') || path.endsWith('.stl') - || path.endsWith('.svg') || path.endsWith('.eot'))).map(path => { + || path.endsWith('.xml') || path.endsWith('.json') || path.endsWith('.txt') + || path.endsWith('.ttf') || path.endsWith('.atom') || path.endsWith('.stl') + || path.endsWith('.svg') || path.endsWith('.eot'))).map(path => { return new Promise((resolve, reject) => { // Grab all assets using hexo router let assetPath = route.get(path) @@ -139,9 +139,9 @@ function logicBrotli () { let routeList = route.list() return Promise.all(routeList.filter(path => (path.endsWith('.html') || path.endsWith('.js') || path.endsWith('.css') - || path.endsWith('.xml') || path.endsWith('.json') || path.endsWith('.txt') - || path.endsWith('.ttf') || path.endsWith('.atom') || path.endsWith('.stl') - || path.endsWith('.svg') || path.endsWith('.eot'))).map(path => { + || path.endsWith('.xml') || path.endsWith('.json') || path.endsWith('.txt') + || path.endsWith('.ttf') || path.endsWith('.atom') || path.endsWith('.stl') + || path.endsWith('.svg') || path.endsWith('.eot'))).map(path => { return new Promise((resolve, reject) => { // Grab all assets using hexo router let assetPath = route.get(path)