mirror of https://github.com/curbengh/hexo-yam
refactor: destructure
This commit is contained in:
parent
ce8c4a145b
commit
37ba1d9a2b
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const Htmlminifier = require('html-minifier').minify
|
||||
const { minify: htmlMinify } = require('html-minifier')
|
||||
const CleanCSS = require('clean-css')
|
||||
const { minify: terserMinify } = require('terser')
|
||||
const Svgo = require('svgo')
|
||||
|
@ -71,7 +71,7 @@ function minifyHtml (str, data) {
|
|||
if (isMatch(path, exclude, globOptions)) return str
|
||||
|
||||
try {
|
||||
const result = Htmlminifier(str, options)
|
||||
const result = htmlMinify(str, options)
|
||||
if (verbose) logFn.call(this, str, result, path, 'html')
|
||||
|
||||
return result
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
'use strict'
|
||||
|
||||
const Hexo = require('hexo')
|
||||
const Htmlminifier = require('html-minifier').minify
|
||||
const { minify: htmlMinify } = require('html-minifier')
|
||||
|
||||
describe('html', () => {
|
||||
const hexo = new Hexo(__dirname)
|
||||
|
@ -26,7 +26,7 @@ describe('html', () => {
|
|||
globOptions: { basename: true }
|
||||
}
|
||||
}
|
||||
const expected = Htmlminifier(input, defaultCfg.html)
|
||||
const expected = htmlMinify(input, defaultCfg.html)
|
||||
|
||||
beforeEach(() => {
|
||||
hexo.config.minify = JSON.parse(JSON.stringify(defaultCfg))
|
||||
|
@ -57,7 +57,7 @@ describe('html', () => {
|
|||
hexo.config.minify.html = customOpt
|
||||
|
||||
const result = h(input, { path })
|
||||
const expected = Htmlminifier(input, customOpt)
|
||||
const expected = htmlMinify(input, customOpt)
|
||||
|
||||
expect(result).toBe(input)
|
||||
expect(result).toBe(expected)
|
||||
|
|
Loading…
Reference in New Issue