Created
April 4, 2020 10:19
-
-
Save sidisinsane/552f56b39541f2f3e3bd78c2168957e3 to your computer and use it in GitHub Desktop.
Create WebP Images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
quality=80 | |
shopt -s nullglob nocaseglob extglob | |
for file in src/assets/img/**/*.@(jpg|jpeg|png); do | |
if [ -f "${file%.*}.webp" ]; then | |
echo "${file%.*}.webp exists" | |
else | |
cwebp -q $quality "$file" -o "${file%.*}.webp" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment