1
1
mirror of https://github.com/rsms/inter.git synced 2024-11-24 05:30:41 +03:00
inter/docs/res/optimize.sh
2017-10-25 11:08:27 -07:00

26 lines
498 B
Bash
Executable File

#!/bin/sh
set -e
cd "$(dirname "$0")"
for f in *.svg; do
svgo --multipass -q "$f" &
done
for f in *.png; do
TMPNAME=.$f.tmp
(pngcrush -q "$f" "$TMPNAME" && mv -f "$TMPNAME" "$f") &
done
pushd sample >/dev/null
for f in *.png; do
TMPNAME=.$f.tmp
if (echo "$f" | grep -q 'thumb'); then
(convert "$f" -flatten -background white -colors 16 "$TMPNAME" && pngcrush -q "$TMPNAME" "$f") &
else
(pngcrush -q "$f" "$TMPNAME" && mv -f "$TMPNAME" "$f") &
fi
done
popd >/dev/null
wait