refactor: destructure object

This commit is contained in:
curbengh 2019-11-09 07:16:07 +00:00
parent 85bfd3ba35
commit de425e4b6f
No known key found for this signature in database
GPG Key ID: 21EA847C35D6E034
1 changed files with 6 additions and 6 deletions

View File

@ -65,9 +65,9 @@ async function minifyCss (str, data) {
if (isMatch(path, exclude, globOptions)) return str
try {
const result = await new CleanCSS(options).minify(str)
if (options.logger) verbose.call(this, str, result.styles, path, 'css')
return result.styles
const { styles } = await new CleanCSS(options).minify(str)
if (options.logger) verbose.call(this, str, styles, path, 'css')
return styles
} catch (err) {
error.call(this, err)
}
@ -94,10 +94,10 @@ function minifyJs (str, data) {
delete jsOptions.logger
delete jsOptions.globOptions
const result = Terser.minify(str, jsOptions)
if (options.logger) verbose.call(this, str, result.code, path, 'js')
const { code } = Terser.minify(str, jsOptions)
if (options.logger) verbose.call(this, str, code, path, 'js')
return result.code
return code
}
function minifySvg () {