diff --git a/.gitignore b/.gitignore index a8262858..430fa743 100755 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,7 @@ dev-data/ RELEASE_NOTES.md CLAUDE.md -.kilocode/** \ No newline at end of file +.kilocode/** + +# minified files +**/*-min.* \ No newline at end of file diff --git a/Makefile b/Makefile index 65c56388..47a98116 100755 --- a/Makefile +++ b/Makefile @@ -117,12 +117,21 @@ mod-tidy: cd ${PWD}/$$path && go mod tidy; \ done -build: +minify-js: + for file in $$(find internal/ -name '*.js' | grep -v -- '-min\.js$$'); do \ + ext="$${file##*.}"; \ + base="$${file%.*}"; \ + min_file="$${base}-min.$$ext"; \ + echo "minifying $$file -> $$min_file"; \ + bunx --bun uglify-js $$file --compress --mangle --output $$min_file; \ + done + +build: minify-js mkdir -p $(shell dirname ${BIN_PATH}) go build -C ${PWD} ${BUILD_FLAGS} -o ${BIN_PATH} ./cmd ${POST_BUILD} -run: +run: minify-js cd ${PWD} && [ -f .env ] && godotenv -f .env go run ${BUILD_FLAGS} ./cmd dev: @@ -140,9 +149,6 @@ benchmark: sleep 1 @./scripts/benchmark.sh -dev-run: build - cd dev-data && ${BIN_PATH} - rapid-crash: docker run --restart=always --name test_crash -p 80 debian:bookworm-slim /bin/cat &&\ sleep 3 &&\ diff --git a/internal/idlewatcher/loading_page.go b/internal/idlewatcher/loading_page.go index 8fdd71a7..c06976d8 100644 --- a/internal/idlewatcher/loading_page.go +++ b/internal/idlewatcher/loading_page.go @@ -25,7 +25,7 @@ var loadingPageTmpl = template.Must(template.New("loading_page").Parse(string(lo //go:embed html/style.css var cssBytes []byte -//go:embed html/loading.js +//go:embed html/loading-min.js var jsBytes []byte func (w *Watcher) writeLoadingPage(rw http.ResponseWriter) error {