esp32-timed-switch/html/minify.sh

14 lines
357 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
APP_PATH=$(cd $(dirname $0) && pwd)
TMP_FILE=$(mktemp)
2024-03-11 08:18:21 +00:00
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"
2024-03-11 08:18:21 +00:00
sed -Ei 's= {2,}= =g' "$FINAL_FILE"
cat "$FINAL_FILE"
rm "$TMP_FILE"