This commit is contained in:
Woody 2024-11-09 21:37:42 +01:00 committed by Woody
parent 271a07a7d6
commit 4b6041302e
No known key found for this signature in database
3 changed files with 247 additions and 1667 deletions

1871
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
"dependencies": {
"clean-css": "^5.3.3",
"html-minifier-terser": "^7.2.0",
"inliner": "^1.13.1",
"web-resource-inliner": "^7.0.0",
"nodemon": "^3.1.7"
}
}

View File

@ -17,7 +17,7 @@
const fs = require("node:fs");
const path = require("path");
const inliner = require("inliner");
const inline = require("web-resource-inliner");
const zlib = require("node:zlib");
const CleanCSS = require("clean-css");
const minifyHtml = require("html-minifier-terser").minify;
@ -127,7 +127,12 @@ async function minify(str, type = "plain") {
async function writeHtmlGzipped(sourceFile, resultFile, page) {
console.info("Reading " + sourceFile);
new inliner(sourceFile, async function (error, html) {
inline.html({
fileContent: fs.readFileSync(sourceFile, "utf8"),
relativeTo: path.dirname(sourceFile),
strict: true,
},
async function (error, html) {
if (error) throw error;
html = adoptVersionAndRepo(html);