render-assets.sh
Bourne-Again shell script, ASCII text executable
1
#! /bin/bash
2
3
INKSCAPE="/usr/bin/inkscape"
4
OPTIPNG="/usr/bin/optipng"
5
6
SRC_FILE="assets.svg"
7
ASSETS_DIR="assets"
8
INDEX="assets.txt"
9
10
for i in `cat $INDEX`
11
do
12
if [ -f $ASSETS_DIR/$i.png ]; then
13
echo $ASSETS_DIR/$i.png exists.
14
else
15
echo
16
echo Rendering $ASSETS_DIR/$i.png
17
$INKSCAPE --export-id=$i \
18
--export-id-only \
19
--export-background-opacity=0 \
20
--export-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
21
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
22
fi
23
done
24
exit 0
25