First of all let me make it clear:
- I understand the benefit of minifying large scripts. E.g. JQuery ~halves in size when minified
- I don't work on huge sites, I'm talking about small-to-medium sites
- I'm not saying my opinion is right, it's more I'm interested in why some people minify everything
My current qualms are:
- I think minifying CSS is almost pointless. At most you save a few kb—unless you do it for obfuscation
- For a small site minifying your site-specific scripts is equally pointless for the same reasons as above
- Combining oft-used scripts into a single file is a good idea but I've seen web developers act in a condascending way about HTTP request yet they have an image gallery on their home page with 20 images—ergo 20 extra HTTP requests. Come on, are they that bad? If you have a decent hoster, I don't see a problem here
So what do you think? Is minifying and combining scripts (and CSS) somewhat of a bandwagon?
It's worth remembering that not everyone who accesses your site will have a nice, fast broadband connection. A growing number of people are accessing the net from mobile devices where a good connection is not always guaranteed, and some home users are still on dial-up! For these users, reducing the number of requests and bytes transferred is going to make a difference.
Thanks for that. Maybe I don't understand HTTP requests but what is the difference between 5 x 10kb requests and 1 x 50kb?
There's overhead associated with making a request (due to headers, cookies etc). You might find this article interesting: http://www.phpied.com/reducing-the-number-of-page-components/
That is very interesting to see how the HTTP requests work. Thank you.
Minifying scrips today has a larger sense.
True, there used to be that you had a monolithic jQuery and minifying it was the only way to shave some bytes.
Today, jQuery has a modular version, following AMD API, which means that you can automatically incorporate in the final file exactly how much you need from jQuery and nothing more, not the whole library.
This is huge gain, and combining the modularization break down with minifying, you can imagine how light your whole site feels now.
Sent from my XT316 using Tapatalk 2
However, I make sure to configure gzip compression in the htaccess file.
If you're not using all the functionality they have to offer, and most likely you aren't, you should consider switching to their AMD version. Nowadays all the significant libraries and frameworks have been modularized.
I'll also add that performance rules such as to minimize HTTP requests are based on research -- repeatable, verifiable numbers. And it turns out that of all the things we can do to speed up our pages, reducing the number of HTTP requests is the #1 most important. The reason is because the browser spends more time just waiting for the first byte of the response than it does on downloading the data itself.
See http://developer.yahoo.com/performance/rules.html and http://stevesouders.com/hpws/rules.php
This topic is now closed. New replies are no longer allowed.