Reducing page footprint from within themes

Reducing page footprint from within themes

by Stuart Lamour -
Number of replies: 4
Picture of Plugin developers

Just messing around with a few ideas :

Minimal page formats

in yr theme if you have a page that don't need any js, don't include any.

just take out $OUTPUT->standard_head_html() and put in a link to your smallest/minimal or page specific css and any js you really need (really??).

works well for frontpage, login, maintenance, 404, any others?

PROS :

these page load really fast 

CONS :

stuff not cached when you go to the next page?

Removing un-used bootstrap components 

Your never going to use that carousel, jumbotron or tooltip stuff so just remove it.

PROS :

less css (no pun intended)

CONS :

you might want to put it back one day???

 

Anyone got any tips they use for reducing the moodle footprint from within themes?

Average of ratings: -
In reply to Stuart Lamour

Re: Reducing page footprint from within themes

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Umm, yep!  Everybody work towards optimising and reducing both the HTML, JS and CSS that is actually required, along with duplication of styles - see MDL-43112.  Refactor and reduce smile

Average of ratings: Useful (2)
In reply to Stuart Lamour

Re: Reducing page footprint from within themes

by David Scotson -
I shared a script here that strips out RTL specific, and IE6&7 specific code:

https://moodle.org/mod/forum/discuss.php?d=244984

I was intending to expand it to strip out -webkit and -moz declarations that aren't needed for modern browsers too.

With some minor changes to the guidlines for RTL and IE6&7 CSS in Moodle, this would be a lot easier. That is, if the CSS for these things didn't also apply to other stuff and always started a line with specific characters like .dir-rtl or .ie6 the regexes would be a lot less scary.
In reply to Stuart Lamour

Re: Reducing page footprint from within themes

by David Scotson -
Not exactly what you asked, but CDNs should in theory make things faster for various reasons. I'd quite like to see the YUI stuff in Moodle default to using the CDN, with a local fallback for closed intranets.
Average of ratings: Useful (1)
In reply to Stuart Lamour

Re: Reducing page footprint from within themes

by David Scotson -
One last reply, and it mostly isn't possible from within themes but I think there's lots of CSS in Moodle that's simply not needed, or is not used. or is only there to work around bugs that could be fixed in the PHP. Getting some attention on those would be good.

Like the first 3 and last 2 lines of this file for example:

https://github.com/moodle/moodle/blob/master/blocks/tags/styles.css

Or this:

https://tracker.moodle.org/browse/MDL-41646

etc.

more ideas linked from MDL-39094

Individually, it's a line here or a couple of lines there, but across the whole of Moodle, and across all Moodle sites, and every user visiting them, it starts to add up. Possibly more importantly it makes Moodle easier to understand for developers and themers.