mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-04-26 00:00:52 +08:00
23 lines
689 B
Bash
Executable file
23 lines
689 B
Bash
Executable file
#!/bin/sh
|
|
|
|
|
|
optimize() {
|
|
# SVG optimization
|
|
scour --strip-xml-space --strip-xml-prolog --remove-metadata --no-line-breaks --enable-id-stripping --enable-comment-stripping --indent=none --remove-descriptive-elements $icon $icon.tmp
|
|
# Remove possible doctype
|
|
sed '/!DOCTYPE/d' < $icon.tmp > $icon
|
|
# Remove trailing newline (imgbot does this and we want to avoid fighting with it)
|
|
truncate -s -1 $icon
|
|
rm $icon.tmp
|
|
}
|
|
|
|
if [ $# -ne 0 ] ; then
|
|
for icon in "$@" ; do
|
|
optimize "$icon"
|
|
done
|
|
exit 0
|
|
fi
|
|
|
|
for icon in weblate/static/icons/*.svg weblate/static/auth/*.svg weblate/static/state/*.svg weblate/static/sort/*.svg ; do
|
|
optimize $icon
|
|
done
|