In 1.35 ResourceLoaderSkinModule and the features property was introduced that allowed skin developers to define an array of feature keys.
In 1.36 we added support for an object of features to allow an opt-in policy.
Now after some time has passed i see two issues with this.
- Skins cannot use new features introduced in 1.36 e.g. normalize without breaking support in 1.35
- Skins cannot use opt in policy e.g. { "normalize": true } without breaking support for 1.35
This is because of 2 things
- The line throw new InvalidArgumentException( "Feature $feature` is not recognised" );` in ResourceLoaderSkinModule
- The opt in policy is not available in 1.35
I suggest we fix these 2 issues by backporting them.
Note for skin developers
Consider a skin that does the following in skin.json
"requires": { "MediaWiki": ">= 1.35.0" }, "skins.name.styles": { "class": "ResourceLoaderSkinModule", "features": { "normalize": true }, "styles": [ "resources/skins.name.styles/skin.less" ] },
prior to this change, this would have broken in 1.35 as the normalize feature is available in 1.36
For skins that want to use the new normalize feature, but retain backwards compatibility in 1.36, they can now register a conditional shim in skin.json
"skins.name.styles.shim": { "styles": [ "resources/skins.name.styles/normalize-shim.less" ] },
and add it via hook:
public static function onBeforePageDisplay( OutputPage $out, $sk ) { $wgVersion = $out->getConfig()->get('Version'); if ( version_compare( $wgVersion, '1.36', '<' ) ) { $out->addModuleStyles( 'skins.name.styles.shim' ); } }
When support for 1.35 is no longer needed the module can simply be removed.