2016-12-05 16:33:56 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# usage:
|
|
|
|
# ./run_on_files.sh FILE...
|
|
|
|
|
2016-12-07 17:51:29 -05:00
|
|
|
SCRIPT_DIR=$(dirname "$0")
|
|
|
|
|
2016-12-05 16:33:56 -05:00
|
|
|
for file in "$@"; do
|
|
|
|
# continue if exist
|
|
|
|
[ -e "$file" ] || continue
|
|
|
|
|
|
|
|
# continue if not symlink
|
|
|
|
[ ! -L "$file" ] || continue
|
|
|
|
|
|
|
|
# continue if extension = svg
|
|
|
|
[ "${file##*.}" == "svg" ] || continue
|
|
|
|
|
|
|
|
echo "=> Workon '$file' ..." >&2
|
|
|
|
|
|
|
|
# optimize
|
2016-12-07 17:51:29 -05:00
|
|
|
svgo --config="$SCRIPT_DIR/svgo.yml" -i "$file"
|
2016-12-05 16:33:56 -05:00
|
|
|
|
|
|
|
# fix
|
2016-12-07 17:51:29 -05:00
|
|
|
eval "$SCRIPT_DIR/_fix_color_scheme.sh" "$file"
|
2016-12-05 16:33:56 -05:00
|
|
|
done
|