esp32-timed-switch/html/minify.sh
2024-03-11 09:18:21 +01:00

14 lines
357 B
Bash
Executable File

#!/usr/bin/env bash
APP_PATH=$(cd $(dirname $0) && pwd)
TMP_FILE=$(mktemp)
FINAL_FILE="${APP_PATH}/minify.html"
cp "$APP_PATH/index.html" "$TMP_FILE"
sed -ri "s/^\s+//" "$TMP_FILE"
sed -ri "s=^//.*$==" "$TMP_FILE"
sed -ri 's="=\\"=g' "$TMP_FILE"
tr -d '\n' < "$TMP_FILE" > "$FINAL_FILE"
sed -Ei 's= {2,}= =g' "$FINAL_FILE"
cat "$FINAL_FILE"
rm "$TMP_FILE"