Browse Source

Rewrite minify.sh to use find more sensibly

master
Chris Smith 4 years ago
parent
commit
63f4b8cf55
Signed by: Chris Smith <chris@chameth.com> GPG Key ID: 3A2D4BBDC4A3C9A9
1 changed files with 3 additions and 8 deletions
  1. 3
    8
      minify.sh

+ 3
- 8
minify.sh View File

@@ -2,13 +2,8 @@
2 2
 
3 3
 set -uxeo pipefail
4 4
 
5
-# Run tidy over all HTML 
6
-for file in $(find /tmp/site/ -name '*.html'); do
7
-	# Tidy exits if there are warnings, which there probably will be...
8
-	tidy -q -i -w 120 -m --vertical-space yes --drop-empty-elements no "$file" || true
9
-done
5
+# Run tidy over all HTML
6
+find /tmp/site/ -name '*.html' -print -execdir tidy -q -i -w 120 -m --vertical-space yes --drop-empty-elements no "{}" \;
10 7
 
11 8
 # Convert all images to WebP
12
-for file in $(find /tmp/site -name '*.jpg' -o -name '*.png' -o -name '*.jpeg'); do
13
-	cwebp -m 6 -mt -o "$file.webp" -- "$file"
14
-done
9
+find /tmp/site \( -name '*.jpg' -o -name '*.png' -o -name '*.jpeg' \) -execdir cwebp -m 6 -mt -o "{}.webp" -- "{}" \;

Loading…
Cancel
Save