Skip to content
Snippets Groups Projects
Unverified Commit 4651ff5a authored by Joas Schilling's avatar Joas Schilling
Browse files

Make the script better readable

parent b1a90da3
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash #!/usr/bin/env bash
function recursive_optimize_images() { function recursive_optimize_images() {
cd $1; cd "$1":
optipng -o6 -strip all *.png;
jpegoptim --strip-all *.jpg; # Optimize all JPGs and PNGs
for svg in `ls *.svg`; optipng -o6 -strip all *.png;
do jpegoptim --strip-all *.jpg;
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; # Optimize all SVGs
done; for svg in `ls *.svg`;
rm *.opttmp do
for dir in `ls -d */`; mv $svg $svg.opttmp;
do scour --create-groups \
recursive_optimize_images $dir; --enable-id-stripping \
cd ..; --enable-comment-stripping \
done; --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 ../ recursive_optimize_images ../
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment