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
9 changes: 8 additions & 1 deletion minify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ do
for filename in `ls $dir/*.$filetype 2> /dev/null | sed "s/\.$filetype//g" | grep -v .min$`
do
do_min=0
#echek if exist a minified version
#check if exist a minified version
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't merge unrelated modification in one commit, especially it has nothing to do with the commit log and pull request.

if [ -f $filename\.min\.$filetype ]; then
#already exist a minified version, compare the modify time to decide compressing or not
orig_ver_time=`eval $LS $filename\.$filetype | awk '{print $6}'`
Expand All @@ -39,6 +39,13 @@ 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
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 "$filename.min.$filetype is bigger than original!"
elif [ $mini_ver_size -eq 0 ]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we will have files with size = 0 ?
If there will be an accident, I think it'll contain some error messages?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! haha... So embarrassing.
As you say, I find there will be some error messages in compressed file, when an accident happens.
I will try another way to check.

echo "$filename.min.$filetype is empty!"
fi
fi
done
done
Expand Down