Migrate to maintained html-minifier fork
This commit is contained in:
parent
3e3c8cf047
commit
a4db1a1116
3 changed files with 599 additions and 160 deletions
753
package-lock.json
generated
753
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -36,7 +36,7 @@
|
||||||
"eslint": "^8.9.0",
|
"eslint": "^8.9.0",
|
||||||
"gh-pages": "^5.0.0",
|
"gh-pages": "^5.0.0",
|
||||||
"glob": "^7.1.4",
|
"glob": "^7.1.4",
|
||||||
"html-minifier": "^4.0.0",
|
"html-minifier-terser": "^7.2.0",
|
||||||
"istanbul": "^0.4.5",
|
"istanbul": "^0.4.5",
|
||||||
"lint-staged": "^13.2.1",
|
"lint-staged": "^13.2.1",
|
||||||
"locater": "^1.3.0",
|
"locater": "^1.3.0",
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const {marked} = require("marked")
|
||||||
const rimraf = promisify(require("rimraf"))
|
const rimraf = promisify(require("rimraf"))
|
||||||
const {execFileSync} = require("child_process")
|
const {execFileSync} = require("child_process")
|
||||||
const escapeRegExp = require("escape-string-regexp")
|
const escapeRegExp = require("escape-string-regexp")
|
||||||
const HTMLMinifier = require("html-minifier")
|
const HTMLMinifier = require("html-minifier-terser")
|
||||||
const upstream = require("./_upstream")
|
const upstream = require("./_upstream")
|
||||||
const version = require("../package.json").version
|
const version = require("../package.json").version
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ class Generator {
|
||||||
else {
|
else {
|
||||||
let html = await fs.readFile(file, "utf-8")
|
let html = await fs.readFile(file, "utf-8")
|
||||||
if (file.endsWith(".md")) html = await this.compilePage(file, html)
|
if (file.endsWith(".md")) html = await this.compilePage(file, html)
|
||||||
const minified = HTMLMinifier.minify(html, htmlMinifierConfig)
|
const minified = await HTMLMinifier.minify(html, htmlMinifierConfig)
|
||||||
await archived(
|
await archived(
|
||||||
relative.replace(/\.md$/, ".html"),
|
relative.replace(/\.md$/, ".html"),
|
||||||
(dest) => fs.writeFile(dest, minified)
|
(dest) => fs.writeFile(dest, minified)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue