2015-12-20 22:32:25 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Minify .png files using imageoptim.
|
|
|
|
#
|
2016-02-18 11:12:21 +01:00
|
|
|
# Can be installed with NPM.
|
2015-12-20 22:32:25 +01:00
|
|
|
# npm install -g imageoptim-cli
|
|
|
|
#
|
2016-02-18 11:12:21 +01:00
|
|
|
# Note: The GUI application also has to be installed.
|
|
|
|
# brew cask install imageoptim
|
|
|
|
#
|
2015-12-20 22:32:25 +01:00
|
|
|
|
2016-02-18 11:12:21 +01:00
|
|
|
if type imageoptim &>/dev/null; then
|
2015-12-20 22:32:25 +01:00
|
|
|
|
|
|
|
if [ "$1" != '' ] ; then
|
|
|
|
|
|
|
|
for file in $1*.png; do
|
|
|
|
echo $file | imageoptim
|
|
|
|
done
|
|
|
|
|
|
|
|
else
|
2016-02-18 11:12:21 +01:00
|
|
|
imageoptim -d "$(dirname $0)"
|
2015-12-20 22:32:25 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|