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