mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Make the script better readable
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
b1a90da347
commit
4651ff5a50
1 changed files with 30 additions and 14 deletions
|
|
@ -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 ../
|
||||
|
|
|
|||
Loading…
Reference in a new issue