-
Notifications
You must be signed in to change notification settings - Fork 11
Check whether the compressed file is bigger than original or is empty #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| 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}'` | ||
|
|
@@ -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 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure we will have files with size = 0 ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right! haha... So embarrassing. |
||
| echo "$filename.min.$filetype is empty!" | ||
| fi | ||
| fi | ||
| done | ||
| done | ||
|
|
||
There was a problem hiding this comment.
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.