#!/bin/bash
# Minify HTML files from src/ to production versions
# Usage: ./minify.sh
# Processes: stratumiops-arch, stratumiops-pipeline, stratumiops-orchestrator
set -e
SCRIPT_DIR="$(dirname "$0")"
FILES=("stratumiops-arch" "stratumiops-pipeline" "stratumiops-orchestrator")
minify_file() {
local basename=$1
local src_file="${SCRIPT_DIR}/src/${basename}.html"
local out_file="${SCRIPT_DIR}/${basename}.html"
local temp_file="${out_file}.tmp"
if [ ! -f "$src_file" ]; then
echo "⚠️ Skipping $basename: source file not found: $src_file"
return 0
fi
echo "🔨 Minifying $basename.html..."
echo " Input: $src_file"
echo " Output: $out_file"
perl -e "
use strict;
use warnings;
open(my \$fh, '<', '$src_file') or die \$!;
my \$content = do { local \$/; <\$fh> };
close(\$fh);
# Remove HTML comments
\$content =~ s///gs;
# Compress CSS (remove spaces and comments)
\$content =~ s/(