From bed71516ffd8e2b56034ecb407c7b7c9a330f7d1 Mon Sep 17 00:00:00 2001 From: rlauuzo <46294892+rlauuzo@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:27:02 +0200 Subject: [PATCH] Minify Configpage (#324) * minify * update node * Update ConfusedPolarBear.Plugin.IntroSkipper.csproj * fix * minimize inject and visualizer js * also add to build --------- Co-authored-by: rlauu <46294892+rlauu@users.noreply.github.com> --- .github/workflows/build.yml | 14 ++++++++++++++ .github/workflows/release.yml | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac50b21..a3aa81c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,20 @@ jobs: with: dotnet-version: 8.0.x + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '>=20' + + - name: Install html-minifier-terser + run: npm install terser html-minifier-terser + + - name: Minify HTML + run: | + npx html-minifier-terser --collapse-boolean-attributes --collapse-whitespace --collapse-inline-tag-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html + npx terser ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js -c -m + npx terser ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -c -m + - name: Restore dependencies run: dotnet restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f1e4cb..4837665 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,20 @@ jobs: with: dotnet-version: 8.0.x + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '>=20' + + - name: Install html-minifier-terser + run: npm install terser html-minifier-terser + + - name: Minify HTML + run: | + npx html-minifier-terser --collapse-boolean-attributes --collapse-whitespace --collapse-inline-tag-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html + npx terser ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js -c -m + npx terser ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -c -m + - name: Restore dependencies run: dotnet restore