ResourceLoader

From MediaWiki.org
Jump to: navigation, search

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 first released in MediaWiki 1.17. Its purpose is to improve MediaWiki's front-end performance and the experience by making use of strong caching while still allowing near-instant deployment of new code that all clients start using within 5 minutes.

About ResourceLoader[edit | edit source]

→ See ResourceLoader/Features for a complete walk through of ResourceLoader

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
    → 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
    → 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
    → 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".

Documentation[edit | edit source]

Manuals[edit | edit source]

Presentations[edit | edit source]

These presentations detail the purpose and results of ResourceLoader.

Tutorials[edit | edit source]

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

Project documents[edit | edit source]

Todo and tasks[edit | edit source]

ResourceLoader
Documentation Features · Vocabulary · Migration guide (users) · Migration guide (developers) · Developing with ResourceLoader · Default modules · Mobile support
Project information Status updates · Version 1 Design Specification (tasks) · Version 2 Design Specification (tasks / tests) · Requirements
Other JavaScript Deprecations