Go to file
2021-09-06 17:29:57 +02:00
.phan initial commit 2021-03-19 21:00:11 +01:00
i18n Update description to link to TemplateStyles page 2021-03-19 16:30:24 -04:00
includes bug: Fix css wide keywords 2021-09-06 17:29:57 +02:00
.eslintignore initial commit 2021-03-19 21:00:11 +01:00
.eslintrc.json initial commit 2021-03-19 21:00:11 +01:00
.gitattributes initial commit 2021-03-19 21:00:11 +01:00
.gitignore initial commit 2021-03-19 21:00:11 +01:00
.gitreview initial commit 2021-03-19 21:00:11 +01:00
.phpcs.xml initial commit 2021-03-19 21:00:11 +01:00
composer.json dist: Release v1.0.1 2021-07-19 19:38:14 +02:00
COPYING initial commit 2021-03-19 21:00:11 +01:00
extension.json dist: Release v1.0.1 2021-07-19 19:38:14 +02:00
Gruntfile.js initial commit 2021-03-19 21:00:11 +01:00
package-lock.json initial commit 2021-03-19 21:00:11 +01:00
package.json initial commit 2021-03-19 21:00:11 +01:00
README.md dist: Release v1.0.1 2021-07-19 19:38:14 +02:00

TemplateStylesExtender

Extends Extension:TemplateStyles by the following new matchers:

  • CSS Variables:
    • Example: color: var( --example-var )
  • image-rendering
  • ruby-position
  • ruby-align
  • scroll-margin-*, scroll-padding-*
  • pointer-events

Installation

Download the zip file from the latest release page.

Extract the folder to extensions/TemplateStylesExtender.
Add the following to LocalSettings.php:

wfLoadExtension( 'TemplateStyles' )
wfLoadExtension('TemplateStylesExtender')

Configuration

$wgTemplateStylesExtenderEnablePrefersColorScheme
Default: true
Enables or disables @media (prefers-color-scheme) queries.

$wgTemplateStylesExtenderEnableCssVars
Default: true
Enables or disables css variable support.

Notes on CSS vars

Currently using :root selectors won't work due to template styles prepending .mw-parser-output.

One possible fix is to wrap the entire content into a div element and adding the declarations to this, e.g.

div#content-wrap {
	--padding: 10px
}

.content {
	padding: var( --padding )
}

Wikitext

<div id="content-wrap">
	<div class=".content">
		The WikiText...
	</div>
</div>