Are CDNs making the benefits of compressing/minifying the css/javascript obsolete?

10    30 May 2016 02:06 by u/rms_returns

I've been reading here lately that we should be compiling the Bootstrap using less and include only those required modules rather than using it all or using a CDN.

But almost everyone uses Google nowadays. And given the huge number of sites referring to the bootstrap.min.css on Google's CDNs, its bound to be on the client's machine already by the time my website is requested. So, my point is what did I achieve by compressing and minifying my css and js? If I had just referred to a CDN, my web-page would have been loaded faster, isn't it?

3 comments

0

a minified heap of js or css is a single stream, giving your connection an opportunity to saturate for the duration of the download.

downloading the assets altogether without being minified would increase the amount of tcp handshaking, as well as the amount of hostname-level blocking (waiting for the previous asset from specific-cdn-hostname to finish before initiating a new one).

i suppose you can cope with this by tuning the client. i don't recall the specific of http pipelining re: whether it would help - i'd have to waterfall a page to see

but yeah thinking about it conceptually i would say minify + cdn would be the way to go - the cdn part gives you that geographical advantage, and minify lets you download one fat chunk from the cdn, without a hole lot of handshaking or keepalives going on.

as a side, i wouldnt recommend including publicly used stuff like bootstrap or jquery or google fonts or what have you - i'd work out automation to host the most up to date copy within your own cdn.

0

The problem of having everything in a single file is that, if you change a bit, everybody is going to have to download everything again. So I vote for CDN as opposed to hosting everything yourself.