Created
September 7, 2016 20:04
-
-
Save ccprog/66df6fef2e42995e09f8f37182c7eaae to your computer and use it in GitHub Desktop.
Optimized asset script for Mint-Y-theme, GTK3 variant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
INKSCAPE="/usr/bin/inkscape" | |
OPTIPNG="/usr/bin/optipng" | |
SRC_FILE="assets.svg" | |
ASSETS_DIR="assets" | |
INDEX="assets.txt" | |
TEMP_INDEX="assets.tmp" | |
for i in `cat $INDEX` | |
do | |
if [ -f $ASSETS_DIR/$i.png ]; then | |
echo $ASSETS_DIR/$i.png exists. | |
else | |
echo $i >> $TEMP_INDEX | |
fi | |
done | |
if [ -f $TEMP_INDEX ]; then | |
echo Rendering... | |
awk \ | |
'{ print "--export-id=" $0, | |
"--export-id-only", | |
"--export-png='$ASSETS_DIR'/" $0 ".png '$SRC_FILE'" } | |
{ print "--export-id=" $0, | |
"--export-dpi=180", | |
"--export-id-only", | |
"--export-png='$ASSETS_DIR'/" $0 "@2.png '$SRC_FILE'" } | |
END { print "quit" }' $TEMP_INDEX | \ | |
$INKSCAPE --shell | awk -F":" '{ if ($1 ~ /Bitmap/) print "Exporting" $2 }' | |
echo Optimizing... | |
for i in `cat $TEMP_INDEX` | |
do | |
$OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png | |
done | |
rm $TEMP_INDEX | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment