mirror of https://github.com/curbengh/hexo-yam
feat: switch to terser for ES6 compatibility
This commit is contained in:
parent
4c2b9e2d1f
commit
2a9c5a52b4
|
@ -1,7 +1,7 @@
|
|||
/* global hexo */
|
||||
'use strict'
|
||||
const CleanCSS = require('clean-css')
|
||||
const UglifyJS = require('uglify-js')
|
||||
const Terser = require('terser')
|
||||
const Htmlminifier = require('html-minifier').minify
|
||||
const Promise = require('bluebird')
|
||||
const minimatch = require('minimatch')
|
||||
|
@ -78,13 +78,13 @@ function logicJs (str, data) {
|
|||
}
|
||||
}
|
||||
|
||||
// uglifyjs doesn't like unsupported options
|
||||
// Terser doesn't like unsupported options
|
||||
delete options.enable
|
||||
delete options.exclude
|
||||
let jsLogger = options.logger
|
||||
delete options.logger
|
||||
|
||||
let result = UglifyJS.minify(str, options)
|
||||
let result = Terser.minify(str, options)
|
||||
let saved = ((str.length - result.code.length) / str.length * 100).toFixed(2)
|
||||
if (jsLogger) {
|
||||
let log = hexo.log || console.log
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"html-minifier": "^4.0.0",
|
||||
"iltorb": "^2.4.2",
|
||||
"minimatch": "^3.0.4",
|
||||
"uglify-js": "^3.5.3"
|
||||
"terser": "^3.17.0"
|
||||
},
|
||||
"keywords": [
|
||||
"html",
|
||||
|
|
Loading…
Reference in New Issue