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).
|
||||
|
||||
|
||||
## Table of contents
|
||||
|
||||
- [Installation](#installation)
|
||||
|
@ -103,13 +102,12 @@ minify:
|
|||
- **priority** - Plugin's priority. Defaults to `10`.
|
||||
- **verbose** - Verbose output. Defaults to `false`.
|
||||
- **exclude** - Exclude files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.
|
||||
- **compress** - Compress options.
|
||||
- **mangle** - Mangle variable names. Defaults to `true`. Pass an object to specify [mangle options](https://github.com/terser-js/terser#mangle-options).
|
||||
- **output** - Output options.
|
||||
- To retain comments, `output: {comments: true}`.
|
||||
- **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://swc.rs/docs/configuration/minification#jscminifymangle).
|
||||
- **format** - [Format options](https://swc.rs/docs/configuration/minification#jscminifyformat).
|
||||
- **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
|
||||
|
||||
|
|
2
index.js
2
index.js
|
@ -39,7 +39,7 @@ hexo.config.minify.js = Object.assign({
|
|||
exclude: ['*.min.js'],
|
||||
compress: {},
|
||||
mangle: true,
|
||||
output: {},
|
||||
format: {},
|
||||
globOptions: { basename: true }
|
||||
}, hexo.config.minify.js)
|
||||
|
||||
|
|
|
@ -109,10 +109,9 @@ async function minifyJs (str, data) {
|
|||
|
||||
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)
|
||||
delete jsOptions.enable
|
||||
delete jsOptions.output
|
||||
delete jsOptions.priority
|
||||
delete jsOptions.verbose
|
||||
// Old option, retained to avoid crash when upgrading to v4
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('js', () => {
|
|||
exclude: ['*.min.js'],
|
||||
compress: {},
|
||||
mangle: true,
|
||||
output: {},
|
||||
format: {},
|
||||
globOptions: { basename: true }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue