From ff2497083490c8d83124d2335780259c0cfbb0aa Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Sat, 27 Jan 2024 12:45:39 -0600 Subject: [PATCH] Minifier --- index.js | 5 +-- package-lock.json | 90 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index f1deda9..95aa54b 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ const express = require('express'), path = require('path'), fs = require('fs'), - WebSocket = require('ws') + WebSocket = require('ws'), + minify = require('minify-html') var app = express() @@ -387,7 +388,7 @@ lanyard.addEventListener("message", (res) => { }) app.get('/', (req, res) => { - res.send(pageUpdate()) + res.send(minify.minify(pageUpdate())) }) app.use((req, res, next) => { diff --git a/package-lock.json b/package-lock.json index 9956d60..34f798a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "dependencies": { "express": "^4.18.2", + "minify-html": "^0.0.2", "ws": "^8.14.2" } }, @@ -372,6 +373,26 @@ "node": ">= 0.6" } }, + "node_modules/minify-html": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/minify-html/-/minify-html-0.0.2.tgz", + "integrity": "sha512-Ph2fWok5inqg1FpLQT2p2fzIfQ/zVIBTQK5YmsgVse/AopJLkYEhveP5akNqelgy0U36vKX36NVI//gVkqo3EA==", + "dependencies": { + "clean-css": "4.x.x", + "uglify-es": "3.x.x" + } + }, + "node_modules/minify-html/node_modules/clean-css": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", + "integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==", + "dependencies": { + "source-map": "~0.6.0" + }, + "engines": { + "node": ">= 4.0" + } + }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -549,6 +570,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -577,6 +606,27 @@ "node": ">= 0.6" } }, + "node_modules/uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "deprecated": "support for ECMAScript is superseded by `uglify-js` as of v3.13.0", + "dependencies": { + "commander": "~2.13.0", + "source-map": "~0.6.1" + }, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/uglify-es/node_modules/commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==" + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -890,6 +940,25 @@ "mime-db": "1.52.0" } }, + "minify-html": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/minify-html/-/minify-html-0.0.2.tgz", + "integrity": "sha512-Ph2fWok5inqg1FpLQT2p2fzIfQ/zVIBTQK5YmsgVse/AopJLkYEhveP5akNqelgy0U36vKX36NVI//gVkqo3EA==", + "requires": { + "clean-css": "4.x.x", + "uglify-es": "3.x.x" + }, + "dependencies": { + "clean-css": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", + "integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==", + "requires": { + "source-map": "~0.6.0" + } + } + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -1019,6 +1088,11 @@ "object-inspect": "^1.9.0" } }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, "statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -1038,6 +1112,22 @@ "mime-types": "~2.1.24" } }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "requires": { + "commander": "~2.13.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==" + } + } + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", diff --git a/package.json b/package.json index 0e27297..402ddae 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "license": "MIT", "dependencies": { "express": "^4.18.2", + "minify-html": "^0.0.2", "ws": "^8.14.2" } }