Created
October 5, 2014 22:38
-
-
Save theasta/f8786b3b56fbb36fb995 to your computer and use it in GitHub Desktop.
Compare js file size before and after minification with uglifyJS2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function comparejsmin() { | |
local origsize=$(wc -c < "$1") | |
local uglifysize=$(uglifyjs "$1" | wc -c) | |
local ratio=$(echo "$uglifysize * 100/ $origsize" | bc -l) | |
printf "Unminified file: %d bytes\n" "$origsize" | |
printf "Minified file: %d bytes (%2.2f%%)\n" "$uglifysize" "$ratio" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment