#!/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"