Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions minify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ do
if [ 0 -lt $do_min ]; then
echo "Compressing $filename.$filetype ..."
curl -X POST -s --data-urlencode "input@$filename.$filetype" ${urls[$filetype]} > $filename\.min.$filetype
#check whether compressed file is bigger than original or not
orig_ver_size=`eval $LS $filename\.$filetype | awk '{print $5}'`
mini_ver_size=`eval $LS $filename\.min\.$filetype | awk '{print $5}'`
if [ $mini_ver_size -gt $orig_ver_size ]; then
echo ": The file $filename.min.$filetype is bigger than the original file."
fi
#if there are some error in original file, compressed file would contain error message.
if [ $mini_ver_size -lt 100 ]; then
match_message=`sed -n '1p' $filename\.min\.$filetype | grep -E "Error:|There is an error" >>/dev/null ; echo $?`
if [ $match_message -eq 0 ]; then
echo ": Could not compress properly, please check the original file."
fi
fi
fi
done
done
Expand Down