On Wed, 01 Feb 2012 04:04:50 -0800, Roan Kattouw roan.kattouw@gmail.com wrote:
On Wed, Feb 1, 2012 at 5:51 AM, Freek Dijkstra software@macfreek.nl wrote:
Hi all,
I've created a copy of the Vector skin. What is the recommended way to register resources (for the resource loader) for a custom skin?
Vector registers the resources in resources/Resources.php
This is not really well thought-out at this point, unfortunately :( . I'll file a bug about this, and think about it for a bit later today.
Roan
I haven't been able to release the skinning tutorial I've been working on, but I have a new recommended file layout for non-core skins.
Goes something like this, assuming a skin called "CloneBook": clonebook/clonebook.php clonebook/CloneBook.i18n.php (or maybe clonebook/clonebook.i18n.php?) clonebook/CloneBook.skin.php clonebook/*.{js,css,etc...} (or something like clonebook/styles/*.css or clonebook/css/*.css if you feel like it instead)
You put the $wgValidSkinNames, $wgAutoloadClasses, $wgResourceModules, etc... data inside of the clonebook/clonebook.php file and include it like an extension: require_once("$IP/skins/clonebook/clonebook.php");
This gives you a number of advantages: - You can finally throw your skin into a tarball and distribute it in a way that can simply be extracted - You don't lose the advantage of resources sitting inside of skins/ - You have a good place to define things like resource loader modules - You have a place for i18n, which was sort of missing before - You can also define extension credits for your skin and get attribution
The key reason for putting it inside of skins/ instead of extensions/ is that by putting it inside of skins/ we have the advantage of having a absolute fact saying that "This is a skin", not some complex extension. And that means that we can start making conventions that are based on that fact and start stripping away the requirements to use extension-like code by slowly introducing various bits of auto-loading into future versions of MediaWiki.
For example in a future version of MediaWiki we may suggest replacing require_once calls and have some sort of skin manifest: SkinLoader::registerSkin( 'clonebook' );
clonebook/clonebook.skin.xml <skin> <key>CloneBook</key> <name lang="en">Clone Book</name> <description lang="en">A clone of MonoBook... what else do you need?</description> <author url="//mediawiki.org/wiki/User:Dantman">Daniel Friesen</author> <mwpage>Skin:CloneBook</mwpage><!-- Alternative to url --> <resource-module> <style media="screen">screen.css</style> <style media="print">print.css</style> </resource-module> </skin>
Then you would have your conventional clonebook/<key>.skin.php file and $wgValidSkinNames, $wgAutoLoadClasses, and wgResourceModules would all be implicitly set, your extension credits would be implicitly set, and the name and description of the skin would implicitly be put into i18n. You would only need an i18n file at that point if you actually used custom i18n message keys inside of your skin. Not just to i18n the name of your skin and it's credits description.