1
Can I use GZIP compression on files that have been minified by Gulp or Grunt? I wonder if there is possibility that I have problems regarding this. Or if I would have an even faster upload on the browser side.
1
Can I use GZIP compression on files that have been minified by Gulp or Grunt? I wonder if there is possibility that I have problems regarding this. Or if I would have an even faster upload on the browser side.
1
Yes, it’s a good idea to minify your files .js
and .css
and then compress them using gzip
.
I did a simple test with the jQuery. I downloaded the non-minified jQuery and the minified:
-rw-rw-r-- 1 user group 258648 Mar 17 23:32 jquery-2.2.2.js
-rw-rw-r-- 1 user group 85656 Mar 17 23:32 jquery-2.2.2.min.js
Notice that the non-minified jQuery has 258 Kb
and the minificado 85 Kb
.
And after that I compressed the two files using the command gzip -9
(-9
represents the slowest and most effective compression):
-rw-rw-r-- 1 user group 76515 Mar 17 23:32 jquery-2.2.2.js.gz
-rw-rw-r-- 1 user group 29763 Mar 17 23:32 jquery-2.2.2.min.js.gz
The jQuery file only compressed possesses 76 Kb
, while the jQuery minified and compressed possesses 29 Kb
.
And since you are already using the Grunt
, take a look at the grunt-contrib-compress
to automate file compression.
Browser other questions tagged linux grunt gulp gulpjs gzip
You are not signed in. Login or sign up in order to post.
Very good your test guy, super enlightening, thank you!
– Dimi Antoni Vargas