Work around T87871 to avoid double-loading OOjs UI PHP styles
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 1 Feb 2016 22:38:37 +0000 (23:38 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 3 Feb 2016 22:47:14 +0000 (23:47 +0100)
commite65186c443a5887024da50b66fe92bcf267a0752
tree9e139596e070dcca017f887254b9c1c74b5dc104
parent8aa6c9f43e9b54e4157a5feee42229a9a48b1764
Work around T87871 to avoid double-loading OOjs UI PHP styles

Use a <meta> tag added when enabling OOUI, and a skipFunction that
looks for it, to avoid double-loading the modules: oojs-ui.styles,
oojs-ui.styles.icons, oojs-ui.styles.indicators, oojs-ui.styles.textures.

This saves us loading of around 200K of CSS (20K when gzipped) on pages
that both use OOjs UI PHP server-side and load OOjs UI client-side.
(For example, all MediaWiki special pages using OOUIHTMLForm.)

Interesting caveat: this causes the aforementioned modules to no
longer appear in the output of `mw.loader.inspect()` on such pages.

Bug: T125292
Change-Id: Ia7e2256cd239841e1f78c4a6bf666dd939c0d2c7
includes/OutputPage.php
resources/ResourcesOOUI.php
resources/src/oojs-ui-styles-skip.js [new file with mode: 0644]