Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Page MenuHomePhabricator

Way to load minified versions of user scripts
Closed, DuplicatePublicFeature

Description

Feature summary:
Load a minified version of javascript pages written by users. (and perhaps CSS as well if possible, but JS pages tend to be the bigger ones)

I imagine accessing this like maybe:

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Ahecht/Scripts/refresh.js&ctype=text/javascript&action=minify');

or perhaps through Special:Minify/User:Ahecht/Scripts/refresh.js.

Use case(s):
Literally anyone who loads user scripts.

Benefits:
Reduced bandwidth needs. Some users create two versions of their script, one minified, one regular. That's obviously more trouble and error-prone than a MediaWiki feature.

Event Timeline

I'm closing this as a duplicate of T344638: Abilty to load compacted versions of javascript and css pages.

See also:

In short: The bandwidth benefits are very minimal in practice compared to the outsized infrastructure and complexity required (both to build, deploy, maintain, and operate; and for users to discover, understand, and make use of). The reason is that gzip compression automatically takes care of the biggest gains already, and for any given user, we already leverage CDN and browser caching, thus avoiding repeat downloads for the same script.

There is of course a small benefit to be had by applying minification, which is why ResourceLoader exists for widely used scripts, and this is exposed to user-maintained scripts via the Gadgets extensions. Once a script is sufficiently widely used that a gadget makes sense, which requires a little bit of effort to adopt, all the other minification and bundling benefits automatically come along. The cost/benefit of building a second separte system for this, does not make sense I think.

Relevant future ideas:

Too bad, but I can see where you're coming from. T36958 sounds super interesting.