Thursday, 17 October 2013

Moving to Bootstrap v3 and a CDN

I've just spent the evening changing jQuery and Twitter Bootstrap from locally hosted assets to be pulled down from Google's Content Delivery Network.

This is something I should have done much earlier, but I never did - my brain would say "what if the CDN goes down - that would make my site look bad".  I've only just realised how ridiculous that sounds; if Google's network goes down, the internet's got bigger problems than my site looking odd.

So, after a bit of research, I chose Google's CDN over JQuery's own as users are more likely to have the Google version in their cache.  Sadly Google don't yet have Bootstrap available, so be sure to star this bug to make it happen, so I chose bootstrapcdn.com to host my bootstrap CSS and Javascript.

That was all very easy and straightforward, and the latest version of JQuery worked absolutely fine... Bootstrap however has been upgraded to v3, which the CDN gives you by default, so rather than finding out how to get the v2 branch, I thought I "may as well" upgrade.  Turns out, they've changed quite a lot of things.

2 hours later, and with a massive thanks to the Bootstrap 3 upgrade service everything looks and works more-or-less how it did before I started, and my sites should be a fraction quicker too.

If you're not convinced, check out this article for 3 good reasons to move to a CDN