refactor: switch minimatch to nanomatch

https://github.com/micromatch/nanomatch
This commit is contained in:
weyusi 2019-04-22 21:40:15 +09:30
parent 2b5585be73
commit 5e19490e44
3 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,7 @@ neat_html:
```
- **enable** - Enable the plugin. Defaults to `true`.
- **logger** - Verbose output. Defaults to `false`.
- **exclude** - Exclude files
- **exclude** - Exclude files. Support [wildcard](https://github.com/micromatch/nanomatch#features) pattern.
For more options, see [HTMLMinifier](https://github.com/kangax/html-minifier).
@ -50,7 +50,7 @@ neat_css:
```
- **enable** - Enable the plugin. Defaults to `true`.
- **logger** - Verbose output. Defaults to `false`.
- **exclude** - Exclude files
- **exclude** - Exclude files. Support wilcard pattern.
----------
@ -65,7 +65,7 @@ neat_js:
- **logger** - Verbose output. Defaults to `false`.
- **output** - Output options
- **compress** - Compress options
- **exclude** - Exclude files
- **exclude** - Exclude files. Support wilcard pattern.
For more options, see [UglifyJS](https://github.com/mishoo/UglifyJS2).

View File

@ -3,7 +3,7 @@
const CleanCSS = require('clean-css')
const Terser = require('terser')
const Htmlminifier = require('html-minifier').minify
const minimatch = require('minimatch')
const nanomatch = require('nanomatch')
const zlib = require('zlib')
const br = require('iltorb')
@ -19,7 +19,7 @@ function logicHtml (str, data) {
if (path && exclude && exclude.length) {
for (let i = 0, len = exclude.length; i < len; i++) {
if (minimatch(path, exclude[i], { matchBase: true })) return str
if (nanomatch.isMatch(path, exclude[i], { matchBase: true })) return str
}
}
@ -44,7 +44,7 @@ function logicCss (str, data) {
if (path && exclude && exclude.length) {
for (let i = 0, len = exclude.length; i < len; i++) {
if (minimatch(path, exclude[i], { matchBase: true })) return str
if (nanomatch.isMatch(path, exclude[i], { matchBase: true })) return str
}
}
@ -73,7 +73,7 @@ function logicJs (str, data) {
if (path && exclude && exclude.length) {
for (let i = 0, len = exclude.length; i < len; i++) {
if (minimatch(path, exclude[i], { matchBase: true })) return str
if (nanomatch.isMatch(path, exclude[i], { matchBase: true })) return str
}
}

View File

@ -21,7 +21,7 @@
"clean-css": "^4.2.1",
"html-minifier": "^4.0.0",
"iltorb": "^2.4.2",
"minimatch": "^3.0.4",
"nanomatch": "^1.2.13",
"terser": "^3.17.0"
},
"keywords": [