1
1
mirror of https://github.com/rsms/inter.git synced 2024-12-19 05:31:32 +03:00
inter/docs/_scripts/optimize-resources.sh

44 lines
654 B
Bash
Raw Normal View History

2017-09-21 20:28:15 +03:00
#!/bin/sh
set -e
2018-02-20 12:38:51 +03:00
cd "$(dirname "$0")/.."
2017-09-21 20:28:15 +03:00
2018-02-19 11:42:47 +03:00
pushd res >/dev/null
2017-09-21 20:28:15 +03:00
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
2018-02-19 11:42:47 +03:00
popd >/dev/null
pushd samples/img >/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
2018-02-19 11:42:47 +03:00
popd >/dev/null
pushd samples/icons >/dev/null
for f in *.svg; do
svgo --multipass -q "$f" &
done
popd >/dev/null
2018-02-19 11:42:47 +03:00
2017-09-21 20:28:15 +03:00
wait