forked from googlefonts/noto-emoji
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scour_svg.sh
executable file
·48 lines (39 loc) · 881 Bytes
/
scour_svg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
SRC_DIR=""
DST_DIR=""
SCOUR_ARGS="--strip-xml-prolog --enable-viewboxing --enable-id-stripping --enable-comment-stripping --shorten-ids --no-line-breaks --strip-xml-space"
while [ $# != 0 ]; do
case "$1" in
-s) SRC_DIR=${2}
shift
shift
;;
-d) DST_DIR=${2}
shift
shift
;;
*) echo "unrecognized arg $1"
exit 1
;;
esac
done
if [ -z "$SRC_DIR" ]; then
echo "missing source directory"
exit 1;
fi
if [ ! -d "$SRC_DIR" ]; then
echo "source directory '$SRC_DIR' does not exist"
exit 1;
fi
if [ -z "$DST_DIR" ]; then
echo "missing destination directory"
exit 1
fi
if [ ! -d "$DST_DIR" ]; then
echo "creating destination directory '$DST_DIR'"
mkdir -p "$DST_DIR"
fi
for file in "$SRC_DIR"/*.svg; do
dst="${file##*/}"
scour $SCOUR_ARGS -i "$file" -o "$DST_DIR/$dst"
done