From 37ba1d9a2b95c0def739637f6ccee6879e403fe8 Mon Sep 17 00:00:00 2001 From: MDLeom <43627182+curbengh@users.noreply.github.com> Date: Sat, 5 Sep 2020 11:22:36 +0000 Subject: [PATCH] refactor: destructure --- lib/filter.js | 4 ++-- test/html.test.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/filter.js b/lib/filter.js index f8e738c..0ce22aa 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -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 diff --git a/test/html.test.js b/test/html.test.js index 8c7e821..98a6365 100644 --- a/test/html.test.js +++ b/test/html.test.js @@ -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)