Website Optimisation

←Back to listing

I’ve altered my already small homesite to run that bit faster by optimising both my JavaScript and CSS files, and also allowing Google to host the jQuery file.

jQuery

After reading 3 Reasons Why You Should Let Google host jQuery, I decided to do so, although I went for the easier link styling of:

<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>

in order to do so.

JavaScript

Since I have created my own JavaScript file with various functions and what not, I also decided to optimise this file. Using the JavaScript Compressor it cut down my original file size of 4.36KB to 2KB, which is a nice reduction. Sure it makes the file unreadable, but any changes that I need to make in the future will be done on the main file, and then I’ll just re-optimise it.

CSS

For this I used CSS Optimiser, and the file size went from 5.06KB down to 3.70KB. Another worthwhile change I feel. Again this makes the file unreadable, but again any changes required will be made on a readable file and I’ll re-optimise it.

However, I did find a bug with CSS Optimiser, but have been unable to report it as their bug report page wouldn’t load for me. The bug revolves around background positions for CSS Sprites. When it creates the code for a background position, it leaves out the -position part and simply adds something like background:-38px -0px; which obviously doesn’t work. So I had to change these by hand to background-position. An annoying issue for sure but one I can live with.

I think it’s well worth taking this time to make these small optimisations, as we all know how annoying it can be for a website to have a slow load time.