Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-04-21 14:30:53 +0300
committerJoas Schilling <coding@schilljs.com>2020-04-21 14:30:53 +0300
commit4651ff5a50d1fb0e88adbbf2adaa734bca3b4c07 (patch)
treedacc5e163b3dc308d7ffbd3a31691a9c903deccf /build
parentb1a90da34730a6c119df4cb5b992177d8dbedeca (diff)
Make the script better readable
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'build')
-rwxr-xr-xbuild/image-optimization.sh44
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 ../