From e81a3853886ab783cc86f7f8c74e738581710e91 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 26 Apr 2024 21:40:09 +0100 Subject: [PATCH] Revert HTML minify library --- node_modules/.package-lock.json | 30 ++++++++++++++++++ package-lock.json | 55 +++++++++++++++++++++++++++++++++ package.json | 2 +- process.js | 6 ++-- 4 files changed, 89 insertions(+), 4 deletions(-) diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 65e0498..a2c3b3f 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -4,6 +4,36 @@ "lockfileVersion": 3, "requires": true, "packages": { + "node_modules/@minify-html/node": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@minify-html/node/-/node-0.15.0.tgz", + "integrity": "sha512-ANzt6ZBiqtwrepVXRfa0Qn/woCkINFBjQEKiXyBmg7+51mIFQHVAUbAm6UHRrT0L3xoPG0BX0/XI3NqtjK8Vyg==", + "bin": { + "minify-html": "cli.js" + }, + "engines": { + "node": ">= 8.6.0" + }, + "optionalDependencies": { + "@minify-html/node-darwin-arm64": "0.15.0", + "@minify-html/node-darwin-x64": "0.15.0", + "@minify-html/node-linux-arm64": "0.15.0", + "@minify-html/node-linux-x64": "0.15.0", + "@minify-html/node-win32-x64": "0.15.0" + } + }, + "node_modules/@minify-html/node-linux-x64": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@minify-html/node-linux-x64/-/node-linux-x64-0.15.0.tgz", + "integrity": "sha512-cO893EV6O9ZHUFX+2Yge546OCo/eCiatjzJDmUmrPP56fQ7pzTRquHs4ko3t8Rg6tMKG7RT49mBuF09JWPnrgg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/camel-case": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", diff --git a/package-lock.json b/package-lock.json index 1090e89..21dd1fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,67 @@ "version": "0.0.1", "license": "ISC", "dependencies": { + "@minify-html/node": "^0.15.0", "clean-css": "^5.3.3", "html-minifier": "^4.0.0", "uglify-js": "^3.17.4", "zlib": "^1.0.5" } }, + "node_modules/@minify-html/node": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@minify-html/node/-/node-0.15.0.tgz", + "integrity": "sha512-ANzt6ZBiqtwrepVXRfa0Qn/woCkINFBjQEKiXyBmg7+51mIFQHVAUbAm6UHRrT0L3xoPG0BX0/XI3NqtjK8Vyg==", + "bin": { + "minify-html": "cli.js" + }, + "engines": { + "node": ">= 8.6.0" + }, + "optionalDependencies": { + "@minify-html/node-darwin-arm64": "0.15.0", + "@minify-html/node-darwin-x64": "0.15.0", + "@minify-html/node-linux-arm64": "0.15.0", + "@minify-html/node-linux-x64": "0.15.0", + "@minify-html/node-win32-x64": "0.15.0" + } + }, + "node_modules/@minify-html/node-darwin-x64": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@minify-html/node-darwin-x64/-/node-darwin-x64-0.15.0.tgz", + "integrity": "sha512-D9M9UDku/8I5VEMS0gTLFFQK1DFXK8io+QZvR5cbya4u8NmdDQix/t3EyCR4Wgv/Gfk86gwIS+zfMSvuKcpb5A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@minify-html/node-linux-x64": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@minify-html/node-linux-x64/-/node-linux-x64-0.15.0.tgz", + "integrity": "sha512-cO893EV6O9ZHUFX+2Yge546OCo/eCiatjzJDmUmrPP56fQ7pzTRquHs4ko3t8Rg6tMKG7RT49mBuF09JWPnrgg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@minify-html/node-win32-x64": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@minify-html/node-win32-x64/-/node-win32-x64-0.15.0.tgz", + "integrity": "sha512-n92IFdtntchlUtyrq13pRI8TT3sOddbzuo4EPTSeocuTJMXaR77v0JYDu0fIjxXNawgGq6nBEeicxAcH4CbvUQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/camel-case": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", diff --git a/package.json b/package.json index c0c9630..4e53533 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ }, "homepage": "https://github.com/git.fjla.uk/web-deploy#readme", "dependencies": { + "@minify-html/node": "^0.15.0", "clean-css": "^5.3.3", - "html-minifier": "^4.0.0", "uglify-js": "^3.17.4", "zlib": "^1.0.5" } diff --git a/process.js b/process.js index 1f07d2c..a4711f8 100644 --- a/process.js +++ b/process.js @@ -1,4 +1,4 @@ -const MinifyHTML = require('html-minifier').minify +const MinifyHTML = require('@minify-html/node') const UglifyJS = require('uglify-js') const CleanCss = require('clean-css') const Zlib = require('zlib') @@ -17,9 +17,9 @@ function ensureDirectoryExists(file_path) { function minifyHtml(input_file, output_file) { const opts = {keep_spaces_between_attributes: true, keep_comments: true} - const minified = MinifyHTML(fs.readFileSync(input_file, 'utf8'), opts) + const minified = MinifyHTML.minify(fs.readFileSync(input_file), opts) ensureDirectoryExists(output_file) - fs.writeFileSync(output_file, minified, 'utf8') + fs.writeFileSync(output_file, minified) } function minifyCss(input_file, output_file) {