Skip to content

Commit

Permalink
build(all): migrate to vite-plugin-html-minifier
Browse files Browse the repository at this point in the history
I must say, it always feels good to end a commit in the net negative.
  • Loading branch information
lishaduck committed Jul 9, 2024
1 parent e8ab67a commit b5c075f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 48 deletions.
2 changes: 1 addition & 1 deletion apps/gpa-calculator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
"eslint": "^8.57.0",
"eslint-config-sheriff": "^18.5.0",
"eslint-define-config": "^2.1.0",
"html-minifier-terser": "^7.2.0",
"lightningcss": "^1.25.0",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite-plugin-html-minifier": "^1.0.4",
"vite-plugin-pwa": "^0.20.0"
},
"markdown": "github",
Expand Down
27 changes: 4 additions & 23 deletions apps/gpa-calculator/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import browserslist from "browserslist";
import browserslistToEsbuild from "browserslist-to-esbuild";
import { minify } from "html-minifier-terser";
import { browserslistToTargets } from "lightningcss";
import { defineConfig } from "vite";
import htmlMinifier from "vite-plugin-html-minifier";
import { VitePWA } from "vite-plugin-pwa";

const browsersList = browserslist();
Expand All @@ -28,28 +28,9 @@ export default defineConfig({
},
},
plugins: [
{
name: "html-minify", // Name of the plugin
transformIndexHtml: {
order: "post",
handler: async (html: string): Promise<string> =>
await minify(html, {
removeAttributeQuotes: true,
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
collapseBooleanAttributes: true,
minifyURLs: true,
collapseInlineTagWhitespace: true,
decodeEntities: true,
noNewlinesBeforeTagClose: true,
removeStyleLinkTypeAttributes: true,
removeScriptTypeAttributes: true,
}),
},
},
htmlMinifier({
minify: true,
}),
VitePWA({
strategies: "injectManifest",
injectManifest: {
Expand Down
2 changes: 1 addition & 1 deletion apps/phs-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
"eslint": "^8.57.0",
"eslint-config-sheriff": "^18.1.0",
"eslint-define-config": "^2.1.0",
"html-minifier-terser": "^7.2.0",
"lightningcss": "^1.24.0",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vite-plugin-html-minifier": "^1.0.4",
"vite-plugin-pwa": "^0.19.0",
"vite-plugin-webfont-dl": "^3.9.1"
},
Expand Down
27 changes: 4 additions & 23 deletions apps/phs-map/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import browserslist from "browserslist";
import browserslistToEsbuild from "browserslist-to-esbuild";
import { minify } from "html-minifier-terser";
import { browserslistToTargets } from "lightningcss";
import { defineConfig } from "vite";
import htmlMinifier from "vite-plugin-html-minifier";
import { VitePWA } from "vite-plugin-pwa";
import webfontDownload from "vite-plugin-webfont-dl";

Expand Down Expand Up @@ -31,28 +31,9 @@ export default defineConfig({
},
plugins: [
webfontDownload(["https://fonts.googleapis.com/css?family=Lato"]),
{
name: "html-minify", // Name of the plugin
transformIndexHtml: {
order: "post",
handler: async (html: string): Promise<string> =>
minify(html, {
removeAttributeQuotes: true,
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
collapseBooleanAttributes: true,
minifyURLs: true,
collapseInlineTagWhitespace: true,
decodeEntities: true,
noNewlinesBeforeTagClose: true,
removeStyleLinkTypeAttributes: true,
removeScriptTypeAttributes: true,
}),
},
},
htmlMinifier({
minify: true,
}),
VitePWA({
strategies: "injectManifest",
injectManifest: {
Expand Down
Binary file modified bun.lockb
Binary file not shown.

0 comments on commit b5c075f

Please sign in to comment.