krinklemail at gmail
Apr 17, 2012, 2:03 PM
Post #7 of 7
On Apr 17, 2012, at 5:08 AM, MZMcBride wrote:
> The URL for CSS used to be something like this:
> Now there's apparently this:
> But this also works:
> Can someone please explain which should be used? Unexpectedly getting rid of
> skins-1.18/ is actively breaking the look of certain pages (such as the www
> portals), but I'm not clear whether I should simply be switching to a new
> MediaWiki version in the URL or if there's something canonical I can use
> instead (which would obviously be preferred).
The MediaWiki skins classes and their resources are bundled in each MediaWiki
release, not supposed to be separated like this. And even then, it is best not
to load the raw files directly.
One of the advantages of ResourceLoader is that modules have symbolic names and
the end-user doesn't need to deal with any version specific file names, file
paths or root directory changes.
So loading the 'skins.monobook' module will at any given point in time load that
module in a way that it is compatible with the wiki it is loaded from.
So on www.wikipedia.org, instead of:
<link rel="stylesheet" href="//bits.wikimedia.org/skins-1.20wmf1/monobook/main.css?303-4" type="text/css" media="screen, projection" />
Use the same that MediaWiki itself uses (based on sample taken from source code
of https://www.mediawiki.org/wiki/MediaWiki?useskin=monobook )
<link rel="stylesheet" href="//bits.wikimedia.org/www.mediawiki.org/load.php?debug=false&lang=en&modules=mediawiki.legacy.commonPrint%2Cshared%7Cskins.monobook&only=styles&skin=monobook&*"/>
That will be more stable than using the raw file from any directory. First,
because it has no version in it. Secondly, it also doesn't have any file path
specific thing. So if monobook would split the css file into multiple files or
rename "main.css" to "screen.css" or whatever, then the above will still work
because it uses the ResourceLoader module name "skins.monobook", and MediaWiki
itself has the module definition of it that contians what it needs and from
This also makes the load module effecient because it is minified (whereas
loading main.css directly is just a raw file).
Wikitech-l mailing list
Wikitech-l [at] lists