mirror of https://github.com/curbengh/hexo-yam
fix(js): rename "output" option to "format"
- https://swc.rs/docs/configuration/minification#jscminifyformat - https://terser.org/docs/api-reference.html#format-options
This commit is contained in:
parent
2e2258f6de
commit
591b1d8713
10
README.md
10
README.md
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
Yet Another Minifier for Hexo. Minify and compress HTML, JS, CSS, SVG, XML and JSON. [Other files](https://github.com/curbengh/hexo-yam/blob/ba77db0094a7c07ea9f70f010bfc15541d4105ca/index.js#L64) are also compressed. Support gzip and [brotli](https://en.wikipedia.org/wiki/Brotli) [compressions](https://en.wikipedia.org/wiki/HTTP_compression).
|
Yet Another Minifier for Hexo. Minify and compress HTML, JS, CSS, SVG, XML and JSON. [Other files](https://github.com/curbengh/hexo-yam/blob/ba77db0094a7c07ea9f70f010bfc15541d4105ca/index.js#L64) are also compressed. Support gzip and [brotli](https://en.wikipedia.org/wiki/Brotli) [compressions](https://en.wikipedia.org/wiki/HTTP_compression).
|
||||||
|
|
||||||
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
|
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
|
@ -103,13 +102,12 @@ minify:
|
||||||
- **priority** - Plugin's priority. Defaults to `10`.
|
- **priority** - Plugin's priority. Defaults to `10`.
|
||||||
- **verbose** - Verbose output. Defaults to `false`.
|
- **verbose** - Verbose output. Defaults to `false`.
|
||||||
- **exclude** - Exclude files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.
|
- **exclude** - Exclude files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.
|
||||||
- **compress** - Compress options.
|
- **compress** - [Compress options](https://swc.rs/docs/configuration/minification#jscminifycompress).
|
||||||
- **mangle** - Mangle variable names. Defaults to `true`. Pass an object to specify [mangle options](https://github.com/terser-js/terser#mangle-options).
|
- **mangle** - Mangle variable names. Defaults to `true`. Pass an object to specify [mangle options](https://swc.rs/docs/configuration/minification#jscminifymangle).
|
||||||
- **output** - Output options.
|
- **format** - [Format options](https://swc.rs/docs/configuration/minification#jscminifyformat).
|
||||||
- To retain comments, `output: {comments: true}`.
|
|
||||||
- **globOptions** - See [globbing](#globbing) section.
|
- **globOptions** - See [globbing](#globbing) section.
|
||||||
|
|
||||||
For more options, see [Terser](https://github.com/terser-js/terser).
|
For more options, see [SWC](https://swc.rs/docs/configuration/minification).
|
||||||
|
|
||||||
## SVG
|
## SVG
|
||||||
|
|
||||||
|
|
2
index.js
2
index.js
|
@ -39,7 +39,7 @@ hexo.config.minify.js = Object.assign({
|
||||||
exclude: ['*.min.js'],
|
exclude: ['*.min.js'],
|
||||||
compress: {},
|
compress: {},
|
||||||
mangle: true,
|
mangle: true,
|
||||||
output: {},
|
format: {},
|
||||||
globOptions: { basename: true }
|
globOptions: { basename: true }
|
||||||
}, hexo.config.minify.js)
|
}, hexo.config.minify.js)
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,9 @@ async function minifyJs (str, data) {
|
||||||
|
|
||||||
if (isMatch(path, exclude, globOptions)) return str
|
if (isMatch(path, exclude, globOptions)) return str
|
||||||
|
|
||||||
// Terser/SWC doesn't like unsupported options
|
// SWC/Terser doesn't like unsupported options
|
||||||
const jsOptions = Object.assign({}, options)
|
const jsOptions = Object.assign({}, options)
|
||||||
delete jsOptions.enable
|
delete jsOptions.enable
|
||||||
delete jsOptions.output
|
|
||||||
delete jsOptions.priority
|
delete jsOptions.priority
|
||||||
delete jsOptions.verbose
|
delete jsOptions.verbose
|
||||||
// Old option, retained to avoid crash when upgrading to v4
|
// Old option, retained to avoid crash when upgrading to v4
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('js', () => {
|
||||||
exclude: ['*.min.js'],
|
exclude: ['*.min.js'],
|
||||||
compress: {},
|
compress: {},
|
||||||
mangle: true,
|
mangle: true,
|
||||||
output: {},
|
format: {},
|
||||||
globOptions: { basename: true }
|
globOptions: { basename: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue