From 9fcf30ea0324af1fb2381806b67d720ca3373622 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 31 Mar 2024 21:56:49 +0530 Subject: [PATCH] fix script --- scripts/pngtowebp.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/pngtowebp.sh b/scripts/pngtowebp.sh index 6b21a0f..a6ee16c 100755 --- a/scripts/pngtowebp.sh +++ b/scripts/pngtowebp.sh @@ -1,6 +1,13 @@ #!/usr/bin/env bash -set -euxo pipefail +set -euo pipefail -fd -tf png$ static/uploads -x cwebp -lossless -mt {} -o {.}.webp -fd -tf png$ static/uploads -X rm -v +function convert_to_webp() { + local DIR + DIR="${1}" + fd -tf png$ "${DIR:?}" -x cwebp -lossless -mt {} -o '{.}.webp' + fd -tf png$ "${DIR:?}" -X rm -v +} + +convert_to_webp static/uploads +convert_to_webp content/posts