From 5f7d8ebe6d8a9a9e5a1b4e9f041ece1a7ae38ab1 Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Fri, 9 Oct 2020 19:20:03 +0530 Subject: Use imagemin to minify images (#323) --- minify-images.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 minify-images.sh (limited to 'minify-images.sh') diff --git a/minify-images.sh b/minify-images.sh new file mode 100755 index 0000000..e9c804c --- /dev/null +++ b/minify-images.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +# Note: This script is needed due to this bug: https://github.com/imagemin/imagemin/issues/348 +# once the above is fixed, we should simply be able to specify the input directory where all image files are to be processed recursively +FILES=`find . -name "*.jpg" -o -name "*.jpeg" -o -name "*.bmp" -o -name "*.png" -type f | GREP_OPTIONS= egrep -v "node_modules"` +for file in $FILES; do + echo "Minifying file: $file" + npx imagemin $file > $file +done -- cgit v1.2.3-70-g09d2