A MediaWiki extension which allows for the transclusion of raw CSS from the RawCSS or Template namespace into pages
Configuration option | Description | Default |
---|---|---|
$wgRawCSSSetCSSContentModel |
Set the default content model for any page in the Template namespace ending in .css to CONTENT_MODEL_CSS |
true |
- The ID is
6200
(and6201
for the talk pages) - The default content model is
less
- The permissions required are:
editrawcss
- The default groups denied this permission are:
*
- The default groups allowed this permission are:
interface-admin
- The default grants which give this permission are:
editsiteconfig
Conflict with TemplateStyles
If $wgRawCSSSetCSSContentModel
is set to true
(by default), you must disable $wgTemplateStylesNamespaces[NS_TEMPLATE]
by setting it to false
in LocalSettings.php
.
Create a page called MediaWiki:RawCSS-applications.json
with a general format like this:
{
"Apple": {
"coatings": [
"RawCSS:Apple styling"
],
"variables": {
"color-apple": "ff007a"
},
"preload": [
{
"href": "https://example.com/",
"as": "image"
}
]
}
}
The general format of MediaWiki:RawCSS-applications.json
is:
- The top-level JSON data type must be an object (the file must start with
{
and end with}
) - Each top-level property must be the name of a template (without the
Template:
prefix) - The
coatings
property must be a list of coating pages (either in the RawCSS (less
orcss
content model) or Template (css
content model only) namespace) - The
variables
property must be an object of CSS variables to set (don't prepend the name with--
) - The
preload
property must be a list of objects which must have thehref
andas
properties sethref
must be a valid URL- See the documentation on
rel=preload
- Create a template with any content; it doesn't matter.
- Create a page, either in the RawCSS (Less or CSS) or Template (CSS only) namespaces.
- Create or edit the
MediaWiki:RawCSS-applications.json
with something like the above snippet (if your template isTemplate:Apple
and your coating isRawCSS:Apple styling
)
- If you need to set a Less variable, add the
variables
property with something like the above snippet. - Setting CSS variables is not supported.
- If you need to add something to be preloaded, add the
preload
property with something like the above snippet.