compress ("minify"/obfuscate) javascript output
Closed, DeclinedPublic


Author: alistrius


i'm actually working on local javascripts, trying to make them like a "formal garden"

so i remove useless bits of code, optimise them and so on, in the purpose of makig them lightest possible, and then less heavy for the servers (i think that every single byte is significant in the common.js, the monobook.css of big projects).

but i also write documentation for the functions i optimise... so the weight i loss in the code optimisation i gain it back because of the comments

so i wonder if it should be possible that the software strip the comments in the stylesheets and javascripts before sending them to the clients.

the full scripts page should remain intact with direct request on them of course.

i think that this feature will save a huge amount of money for wikimedia.

Kind regards

Version: unspecified
Severity: enhancement


bzimport set Reference to bz12250.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Dec 8 2007, 11:43 PM

alistrius wrote:

and besides this money consideration, it should be a nice feature

I'm against this. In my experience, the savings from javascript compressors post-gzip are so small that you could only justify it on the grounds of obfuscation. Obfuscation is not what we're about. These files are cached on the client side so typically sent to the user once per visit.

If you want something to optimise, try the 51KB of edit tools we send out every time someone clicks a red link (over 100KB on commons).

alexsm333 wrote:

I remember at least 3 proposals on en.wp to replace Edittools with JavaScript. There was no opposition, but none of the admins was brave enough to actually implement this (sorry for offtopic).

ayg wrote:

I agree with Tim. We already compress it, using gzip. The benefits of any further compression are outweighed by the annoyance of anyone who actually wants to read the stuff.

According to YSlow (, a number of JS files from commons are not gzip'd. Try editing a page on commons in Firefox and take a look at the response headers of wikibits.js for example. YSlow also complains that the commons logo doesn't have an expires header. There's probably a good reason for that that's beyond me.

brion added a comment.Mar 25 2008, 5:14 PM

Raw files are not currently compressed as they are served directly by the web server, which we have not currently configured to compress them (though we plan to do so).

Any JS served directly out of the wiki gets compressed.

This feature request though was about *obfuscation* for the purposes of making the files smaller; that's something we'll reject regardless of the use or non-use of gzip compression, as it makes debugging and customization much more difficult.

I've updated the summary to clarify.

Add Comment