Since the startup payload varies by skin, the Gadgets extension should take advantage of this by not registering gadgets that are only enabled in certain skins.
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | SD0001 | T253582 Let ResourceLoader only register skin modules for the current skin | |||
Resolved | SD0001 | T236603 Only register gadgets client-side from startup if relevant for the current skin |
Event Timeline
@Krinkle I found documentation for how to add additional scripts for specific skins, but how can $wgResourceModules be set to only load entire modules for specific skins?
This task is not about how modules are loaded (addModules), and not about how module content is defined (scripts/packagFiles etc).
The task is about when modules are registered. Registration reduction helps improve the startup module performance.
Registration can happen in one of two ways:
- Statically, from extension.json (or Resources.php) with an array or object for simple file modules.
- Dynamically, from the ResourceLoaderRegisterModules hook.
Gadgets are registered dynamically, since they are defined by end-users via MediaWiki:Gadgets-definition from a page.
There is a Gadget option called skins that gadget developers can use to indicate when the gadget module should load. The PHP code in the Gadgets extension uses this today to only call addModules in skins that the gadget supports.
The proposal is that for gadgets that use the skins option, to also only register them in skins that the gadget supports.
Change 735980 had a related patch set uploaded (by SD0001; author: SD0001):
[mediawiki/extensions/Gadgets@master] Only register gadgets if relevant for the current skin
Change 735980 abandoned by SD0001:
[mediawiki/extensions/Gadgets@master] Only register gadgets if relevant for the current skin
Reason:
Wrong approach
Change 749861 had a related patch set uploaded (by SD0001; author: SD0001):
[mediawiki/core@master] resourceloader: Only register modules client-side if relevant to current skin
Change 749862 had a related patch set uploaded (by SD0001; author: SD0001):
[mediawiki/extensions/Gadgets@master] Add getSkins() in GadgetResourceLoaderModule
Change 749861 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Add Module::getSkins to skip irrelevant modules from startup
Change 749862 merged by jenkins-bot:
[mediawiki/extensions/Gadgets@master] Add getSkins() in GadgetResourceLoaderModule