ResourceLoader


 * To migrate a Gadget to ResourceLoader, read Migration guide. MediaWiki 1.26 removed support for legacy gadgets.

ResourceLoader is the delivery system in MediaWiki for the optimized loading and managing of modules. Modules consist of JavaScript, CSS and interface messages. ResourceLoader was created in 2010 by Roan Kattouw, Trevor Parscal, and Timo Tijhof.

The system was first released in 2011 as part of MediaWiki 1.17. It provides MediaWiki with a high-performant front-end, built on strong caching while still allowing fast deployment of new code that all clients receive within minutes.

About ResourceLoader

 * &rarr; See ResourceLoader/Architecture to learn about the systems's principles and overall design.

On Wikimedia wikis, every page view includes hundreds of kilobytes of JavaScript. In many cases, some or all of this code goes unused due to lack of browser support or because users do not make use of the features on the page. In these cases, bandwidth, and loading time spent on downloading, parsing and executing JavaScript code is wasted. This is especially true when users visit MediaWiki sites using older browsers like Internet Explorer 6, where almost all features are unsupported, and parsing and executing JavaScript is extremely slow.

ResourceLoader solves this problem by loading resources on-demand and only for browsers that can run them. Although there is much more to it, the overall flow for client-side performance can be summarized by these 3 points:
 * Minifying and concatenating &rarr; which reduces the code's size and parsing/download time Both JavaScript files, CSS files and interface messages are loaded in a single special formatted "ResourceLoader Implement" server response.
 * Batch loading &rarr; which reduces the number of requests made The server response for module loading supports loading multiple modules so that a single response contains multiple ResourceLoader Implements, which in itself contain the minified and concatenated result of multiple javascript/css files.
 * Data URI embedding &rarr; which further reduces the number of requests, response time and bandwidth Optionally images referenced in stylesheets can be embedded as data URIs. Together with the gzipping of the server response, those embedded images, together, function as a "super sprite".

Manuals

 * Architecture – Complete overview of ResourceLoader architecture.
 * Developing with ResourceLoader – notes on configuring your development environment and on switching ResourceLoader between development and production modes.
 * Migration guide for extension developers – a guide to making extensions to work with ResourceLoader.
 * Migration guide (users)
 * Core modules – an overview of all core modules, supported with documentation and examples.
 * Third party modules – list of known MediaWiki extensions who provide ResourceLoader modules.
 * Legacy JavaScript – index of legacy JavaScript functions that predate ResourceLoader modules.
 * ResourceLoader/Developing with Webpack - optional guide for those wondering how to use webpack in a RL compatible way.
 * Vocabulary – the terminology used in ResourceLoader (such as Loader, Module, Requirement, etc.)

Presentations
These presentations detail the purpose and results of ResourceLoader.

Tutorials
These presentations go more in-depth towards developers already familiar with MediaWiki development.