Skip to content

Commit

Permalink
feat: switch to terser for ES6 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
weyusi committed Apr 10, 2019
1 parent 4c2b9e2 commit 2a9c5a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/filter.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2a9c5a5

Please sign in to comment.