drquincy — 2013-10-21T08:01:21-04:00 — #1
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?
fretburner — 2013-10-21T08:23:52-04:00 — #2
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.
drquincy — 2013-10-21T08:42:04-04:00 — #3
Thanks for that. Maybe I don't understand HTTP requests but what is the difference between 5 x 10kb requests and 1 x 50kb?
fretburner — 2013-10-21T09:00:52-04:00 — #4
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/
drquincy — 2013-10-21T09:15:27-04:00 — #5
That is very interesting to see how the HTTP requests work. Thank you.
system — 2013-10-21T13:57:17-04:00 — #6
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.
kiwiheretic — 2013-10-21T14:20:01-04:00 — #7
Sent from my XT316 using Tapatalk 2
force — 2013-10-21T14:49:52-04:00 — #8
However, I make sure to configure gzip compression in the htaccess file.
system — 2013-10-21T15:48:11-04:00 — #9
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.
jeff_mott — 2013-10-21T22:43:21-04:00 — #10
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