feat: add CSS/JS minification to build pipeline

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-05-09 16:36:57 -05:00
parent f888b8c8b4
commit 3c4eb9bcce
3 changed files with 32 additions and 1 deletions
+15
View File
@@ -314,6 +314,21 @@ jobs:
echo "Release updated: ${RELEASE_TAG} -> ${VERSION}" >> $GITHUB_STEP_SUMMARY
fi
- name: "Step 7.5: Minify assets"
if: >-
steps.version.outputs.skip != 'true'
run: |
npm install --no-save terser clean-css 2>/dev/null || true
MINIFY=""
for p in "../moko-platform/build/minify.js" "scripts/minify.js"; do
[ -f "$p" ] && MINIFY="$p" && break
done
if [ -n "$MINIFY" ]; then
node "$MINIFY" src
else
echo "No minify script found — skipping"
fi
# -- Summary --------------------------------------------------------------
- name: Pipeline Summary
if: always()
+2
View File
@@ -117,6 +117,8 @@ site/
*.map
*.css.map
*.js.map
*.min.css
*.min.js
*.tsbuildinfo
# ============================================================
+15 -1
View File
@@ -23,8 +23,22 @@ install-deps: ## Install dependencies
@$(NPM) install
@echo "$(COLOR_GREEN)✓ Dependencies installed$(COLOR_RESET)"
MOKO_PLATFORM ?= $(or $(wildcard ../moko-platform),$(wildcard $(HOME)/moko-platform),$(wildcard /opt/moko-platform))
MINIFY_SCRIPT := $(MOKO_PLATFORM)/build/minify.js
.PHONY: minify
minify: ## Minify CSS/JS assets
@echo "Minifying assets..."
@if [ -f "$(MINIFY_SCRIPT)" ]; then \
node "$(MINIFY_SCRIPT)" $(SRC_DIR); \
elif [ -f "scripts/minify.js" ]; then \
node scripts/minify.js; \
else \
echo "No minify script found"; \
fi
.PHONY: build
build: ## Build TypeScript
build: minify ## Build TypeScript
@$(NPM) run build
@echo "$(COLOR_GREEN)✓ Build complete$(COLOR_RESET)"