mirror of https://github.com/curbengh/hexo-yam
refactor: destructure object
This commit is contained in:
parent
85bfd3ba35
commit
de425e4b6f
|
@ -65,9 +65,9 @@ async function minifyCss (str, data) {
|
||||||
if (isMatch(path, exclude, globOptions)) return str
|
if (isMatch(path, exclude, globOptions)) return str
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await new CleanCSS(options).minify(str)
|
const { styles } = await new CleanCSS(options).minify(str)
|
||||||
if (options.logger) verbose.call(this, str, result.styles, path, 'css')
|
if (options.logger) verbose.call(this, str, styles, path, 'css')
|
||||||
return result.styles
|
return styles
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.call(this, err)
|
error.call(this, err)
|
||||||
}
|
}
|
||||||
|
@ -94,10 +94,10 @@ function minifyJs (str, data) {
|
||||||
delete jsOptions.logger
|
delete jsOptions.logger
|
||||||
delete jsOptions.globOptions
|
delete jsOptions.globOptions
|
||||||
|
|
||||||
const result = Terser.minify(str, jsOptions)
|
const { code } = Terser.minify(str, jsOptions)
|
||||||
if (options.logger) verbose.call(this, str, result.code, path, 'js')
|
if (options.logger) verbose.call(this, str, code, path, 'js')
|
||||||
|
|
||||||
return result.code
|
return code
|
||||||
}
|
}
|
||||||
|
|
||||||
function minifySvg () {
|
function minifySvg () {
|
||||||
|
|
Loading…
Reference in New Issue