From c8d2afd2353cb07373e14787a6074a3291d5dbb8 Mon Sep 17 00:00:00 2001 From: Spirit Date: Mon, 26 Aug 2024 22:22:46 +0300 Subject: [PATCH] only make a backup if doesnt exist already --- html-minify.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/html-minify.sh b/html-minify.sh index 5aacfad..6a186c4 100755 --- a/html-minify.sh +++ b/html-minify.sh @@ -68,7 +68,10 @@ if [[ -f "$html_file" ]]; then fi done < "${html_file}.tmp" - cp "$html_file" ".original-${html_file}" + if [[ ! -f ".original-${html_file}" ]]; then + cp "$html_file" ".original-${html_file}" + fi + echo generated ".original-${html_file}" html-minifier --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true "${html_file}.tmp" > "$html_file" fi