diff options
author | Joas Schilling <coding@schilljs.com> | 2020-04-21 13:30:53 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-04-21 13:30:53 +0200 |
commit | 4651ff5a50d1fb0e88adbbf2adaa734bca3b4c07 (patch) | |
tree | dacc5e163b3dc308d7ffbd3a31691a9c903deccf /build/image-optimization.sh | |
parent | b1a90da34730a6c119df4cb5b992177d8dbedeca (diff) | |
download | nextcloud-server-4651ff5a50d1fb0e88adbbf2adaa734bca3b4c07.tar.gz nextcloud-server-4651ff5a50d1fb0e88adbbf2adaa734bca3b4c07.zip |
Make the script better readable
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'build/image-optimization.sh')
-rwxr-xr-x | build/image-optimization.sh | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/build/image-optimization.sh b/build/image-optimization.sh index a1be5d22ce1..65a5bb46362 100755 --- a/build/image-optimization.sh +++ b/build/image-optimization.sh @@ -1,20 +1,36 @@ #!/usr/bin/env bash function recursive_optimize_images() { -cd $1; -optipng -o6 -strip all *.png; -jpegoptim --strip-all *.jpg; -for svg in `ls *.svg`; -do - mv $svg $svg.opttmp; - scour --create-groups --enable-id-stripping --enable-comment-stripping --shorten-ids --remove-metadata --strip-xml-prolog --no-line-breaks -i $svg.opttmp -o $svg; -done; -rm *.opttmp -for dir in `ls -d */`; -do - recursive_optimize_images $dir; - cd ..; -done; + cd "$1": + + # Optimize all JPGs and PNGs + optipng -o6 -strip all *.png; + jpegoptim --strip-all *.jpg; + + # Optimize all SVGs + for svg in `ls *.svg`; + do + mv $svg $svg.opttmp; + scour --create-groups \ + --enable-id-stripping \ + --enable-comment-stripping \ + --shorten-ids \ + --remove-metadata \ + --strip-xml-prolog \ + --no-line-breaks \ + -i $svg.opttmp \ + -o $svg; + done; + + # Remove temporary SVGs + rm *.opttmp + + # Check all subfolders + for dir in `ls -d */`; + do + recursive_optimize_images $dir; + cd ..; + done; } recursive_optimize_images ../ |