Skip to content

Commit

Permalink
chore: reduce bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Oct 5, 2024
1 parent 1898d9d commit 3f164b5
Show file tree
Hide file tree
Showing 4 changed files with 240 additions and 210 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
indent_size = 4
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cleanup:
build-client:
@echo "Building client code..."
@pnpm exec vite build src/client
make clean-html

build-server:
@echo "Building server code..."
Expand All @@ -40,3 +41,17 @@ lint:
format:
@echo "Formatting code..."
pnpm exec dprint fmt

clean-html:
@echo "Cleaning up html file..."
@awk 'BEGIN \
{ RS=""; FS=""; ORS="" } \
{ \
gsub(/<script[^>]*>[\\s\\S]*?<\/script>/, ""); \
gsub(/<link[^>]*rel="stylesheet"[^>]*>/, ""); \
gsub(/<title>[^<]*<\/title>/, ""); \
gsub(/[ \t\n\r]+/, " "); \
print \
} \
' dist/client/index.html > dist/client/index.tmp && \
mv dist/client/index.tmp dist/client/index.html
Loading

0 comments on commit 3f164b5

Please sign in to comment.