From 8f7fdcc8f0e7f1c53974f8ad47b76f330522cc18 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 1 Mar 2021 18:20:22 -0500 Subject: [PATCH] fix: use html-minifier-terser instead of html-minifier html-minifier-terser was developed based on html-minifier, and the difference between them is that html-minifier-terser can minify inline ES6 scripts in html file, but html-minifier cannot. --- lib/filter.js | 2 +- package.json | 2 +- test/html.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/filter.js b/lib/filter.js index c41f46b..4b1c3c7 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -1,6 +1,6 @@ 'use strict' -const { minify: htmlMinify } = require('html-minifier') +const { minify: htmlMinify } = require('html-minifier-terser') const CleanCSS = require('clean-css') const { minify: terserMinify } = require('terser') const Svgo = require('svgo') diff --git a/package.json b/package.json index 2738b4a..5cf3cb7 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "repository": "curbengh/hexo-yam", "dependencies": { "clean-css": "^4.2.1", - "html-minifier": "^4.0.0", + "html-minifier-terser": "^5.1.1", "micromatch": "^4.0.2", "minify-xml": "^2.1.1", "svgo": "^1.2.2", diff --git a/test/html.test.js b/test/html.test.js index 3b48989..0534a77 100644 --- a/test/html.test.js +++ b/test/html.test.js @@ -2,7 +2,7 @@ 'use strict' const Hexo = require('hexo') -const { minify: htmlMinify } = require('html-minifier') +const { minify: htmlMinify } = require('html-minifier-terser') describe('html', () => { const hexo = new Hexo(__dirname)