1
1
mirror of https://github.com/rsms/inter.git synced 2024-11-30 01:15:54 +03:00
inter/docs/optimize-resources.sh
Rasmus Andersson a9e87c52d5 website update
2018-02-19 00:42:47 -08:00

44 lines
651 B
Bash
Executable File

#!/bin/sh
set -e
cd "$(dirname "$0")"
pushd res >/dev/null
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
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
popd >/dev/null
pushd samples/icons >/dev/null
for f in *.svg; do
svgo --multipass -q "$f" &
done
popd >/dev/null
wait