Ability to turn js files into minimised versions for production sites

Bug #1259650 reported by Robert Lyon
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Wishlist
Unassigned

Bug Description

Currently in mahara most css and javascript files are not compressed/minimised - this is great if you are editing them as a designer / programmer but means it is slower for sites to load.

It would be good if there could be a system that miniaturizes css / js files for production sites,
ie when $cfg->productionmode = true

I'm not sure how this will work - possibly an admin page with options on what to minimise (that can also be accessed via commandline for deployment scripts to access if needed) in conjunction with a mod_rewrite rule so that the correct files are accessed.

Or maybe some other way of doing it - it would be good to find out what others do for this kind of thing.

Tags: css javascript
Revision history for this message
Leo Xiong (leoxiong) wrote :

A solution would be to setup mod_pagespeed for Apache. Not only does it minify Javascript and CSS, it also performs *many* other page optimizations. It’s licensed under Apache License 2.0. I've had great experience with it in the past.

https://developers.google.com/speed/pagespeed/module

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Checked https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses and Apache license 2.0 is compatible with GPL 3+. Would that feature then also work with nginx?

Revision history for this message
Leo Xiong (leoxiong) wrote :

Yup, it supports Apache and nginx. There is an unofficial port for IIS but costs for commercial use.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Would this item still be needed when we move to Bootstrap as that is SASS?

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

So if we always use SASS we'll be fine for CSS, but would still need to look into minimizing the Javascript.

summary: - Ability to turn css / js files into minimised versions for production
- sites
+ Ability to turn js files into minimised versions for production sites
Changed in mahara:
status: New → Confirmed
Revision history for this message
Aaron Wells (u-aaronw) wrote :

I think minification itself is sort of overrated. It does improve performance, but not by a whole lot, like 5%.

So if it's easy to do, sure, we may as well (as long as we also include an option to de-minify for dev purposes).

Something else we could do that might improve performance more, would be to reduce the total number of file requests needed for each page, by concatenating some of the CSS stylesheets together. Likewise for Javascript files.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.