For the longest time, core skins had a big advantage: they could use the 'skinStyles' parameter of a ResourceLoader module definition, in core's Resources.php file, to provide different looks for various built-in functionality. Non-core skin creators could achieve the same by putting the styles in main skin styles, but this has two big disadvantages: the styles would be loaded even if not needed on given page, and one often had to use ugly hacks to "reset" core styles.

With [1] merged, non-core skins can finally do the same, and do it right, using the new $wgResourceModuleSkinStyles global (akin to $wgResourceModules):

  // Module defined in core or some extension
  $wgResourceModules['bar'] = array(
    'scripts' => 'resources/bar/bar.js',
    'styles' => 'resources/bar/main.css',
  );

  // Styles defined in the skin
  $wgResourceModuleSkinStyles['foo'] = array(
    'bar' => 'skins/Foo/bar.css',
  );

Documentation is available at <https://www.mediawiki.org/wiki/Manual:$wgResourceModuleSkinStyles>.

I have already converted Vector to make use of this [2] and I am in the process of doing the same for Minerva [3][4] (the second patch still pending, reviews welcome) – MobileFrontend developers were forced to do some really bad things by the previous limitations ;)

Perhaps someone would be interested in doing this for MonoBook, too? It currently uses the "everything in main style file" approach.

Have fun!


[1] https://gerrit.wikimedia.org/r/#/c/141259/
[2] http://git.wikimedia.org/blob/mediawiki%2Fcore.git/1ebad72b0b45209ab04562716af0d1ff7b4efda6/skins%2FVector%2FVector.php#L66
[3] https://gerrit.wikimedia.org/r/#/c/149780/
[4] https://gerrit.wikimedia.org/r/#/c/150580/

--
Matma Rex

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to