Manual:$wgResourceModuleSkinStyles/fr

La variable globale $wgResourceModuleSkinStyles permet aux habillages de fournir des feuilles de style supplémentaires pour personnaliser les modules ResourceLoader existants. Skins can modify it by editing the ResourceModuleSkinStyles key in skin.json. Extensions can make their module styles customizable by skins by setting the skinStyles key on their ResourceLoader module definitions.

Ces deux éléments facilitent (ou rend possible) le remplacement des styles par défaut et réduit l'empreinte du style d'un habillage en ne chargeant pas les styles non utilisés sur la plupart des pages. Par exemple, si un habillage a beaucoup de code CSS pour remplacer la présentation de la page Special:UserLogin, il peut le mettre dans un fichier CSS ou LESS séparé qui remplace 'mediawiki.special.userlogin.login.styles' et ResourceLoader ne chargera ce CSS d'habillage que lorsqu'une page aura besoin de ce module.

$wgResourceModuleSkinStyles est un tableau multidimensionnel : Au premier niveau, on trouve le nom du paquet (habillage ou extension) qui ajoute des styles complémentaires (dans l'exemple suivant appelé « foo »). Au second niveau on trouve les paires clé et valeur :


 * The keys always are the module names, for which additional styles should be used. By default, your definition will then replace the CSS/LESS file, which has already defined styles for this module before. If the module name in contrast is prepended by a "+" sign, then your styles will be added to those styles, which had already been defined before, thus not replacing complete files, but preserving all styles and only overwriting/adding those, which you are defining.
 * The value is the relative path to the according file. Multiple files can be added to a module by writing them inside an array.

Vector is one of the skins using this method, and provides a good practical usage demonstration: https://phabricator.wikimedia.org/diffusion/SVEC/browse/master/skin.json. The definition can be found under the key.

See documentation for for basic information about defining and using ResourceLoader modules.

Documentation
The ResourceModuleSkinStyles key inside skin.json can be used to alter the styles of known ResourceLoader modules that have been defined in the ResourceModules key of other extensions.

The styles defined using $wgResourceModuleSkinStyles are later added to the  list of the existing module. The  list can not be modified or disabled.

For example, if this is the definition of the ResourceLoader module bar:

then this is how skin Foo would provide additional styles for it:

This is mostly equivalent to:

If the module already defines its own entry in  for a given skin, then $wgResourceModuleSkinStyles is ignored.

If a module defines a  the skin may want to extend that instead of replacing them. This can be done using the  prefix.

Example:

This is mostly equivalent to:

In other words, as a module author, use the  list for stylesheets that may not be disabled by a skin. To provide default styles that may be extended or replaced, use.

As with $wgResourceModules, paths default to being relative to the MediaWiki root. You should always provide a  and   (or  / ).

Example:



Effacer les styles de l'interface utilisateur MediaWiki
Core MediaWiki adds the CSS of MediaWiki UI ResourceLoader modules as the   , allowing skins to override their styling. For an extreme example, to eliminate most styling: