← blogs.sussex.ac.uk

Things we love about moodle2 pt1 – minify, gzip & exclude

In moodle 1.9 we spent a lot of time optimising the page load speeds and improving the quality of our code.

Using tools including:

allowed us to analyses what was slowing pages down, and how to improve this.

1. Minify and compress

Moodle2 comes with built in minify and gzipping for css and javascript!

2. Load things in the right place

Moodle2 theme config.php allows us to load javascript in the footer of the page instead of the header :
$THEME->javascripts_footer = array();

3. Don’t load things you don’t need

Moodle2 allows us to exclude parent theme css and javascript :

$THEME->parents_exclude_javascripts = array();
$THEME->parents_exclude_sheets = array();

Minifying javascript can create some interesting results, so the fact that the moodle2 team thought about and managed to do this is very much appreciated.

For anyone interested in speeding up their site – the best practice guidelines by yahoo & google (along with the tools above) can be an interesting insight into improving things for your users, and making your code better.

So far, we are just evaluating a test install of moodle2, but will be updating the blog with further findings.


  1. Leonard Houx
    Posted June 24, 2013 at 4:25 pm | Permalink

    Brilliant stuff! Do you still stand by these recommendations? They look great. I understand that you are not supposed to load the js for Google Analytics at the bottom, but if we could get the other js at the bottom, it would probably help our YSLOW grade a fair bit 🙂

  2. Stuart Lamour
    Posted August 10, 2013 at 12:15 am | Permalink

    Hi Leonard – i do – We even load our analytics as the last thing before the closing body tag and have never had any problems – users don’t need it to use the page, so why not load it after the dom has rendered?

One Trackback

  1. […] already talked in a previous blogpost about the ability in moodle2 themes to include and exclude css & javascript from a themes […]

Post a Comment

Your email is never shared. Required fields are marked *