Jump to content

Extension:TemplateStylesExtender: Difference between revisions

From mediawiki.org
Content deleted Content added
mNo edit summary
Tag: 2017 source edit
m Translate extension now adds untranslated anchors
Line 44: Line 44:
}}
}}


{{anchor|Configuration}}
<translate>
<translate>
== Configuration == <!--T:5-->
== Configuration == <!--T:5-->

Revision as of 08:12, 26 November 2022

MediaWiki extensions manual
TemplateStylesExtender
Release status: stable
Implementation Parser extension
Description Extends Extension:TemplateStyles with new selectors
Author(s) Octfxtalk
Latest version 1.1.0 (2022-09-30)
MediaWiki 1.35+
PHP 7.2+
Composer octfx/template-styles-extender
License GNU General Public License 2.0 or later
Download

  • $wgTemplateStylesExtenderEnablePrefersColorScheme

The TemplateStylesExtender extension extends Extension:TemplateStyles with new selectors and matchers.

Features

  • Add support for CSS variables
    • Example color: var( --color-base )
  • Add support for image-rendering
  • Add support for ruby-position
  • Add support for ruby-align
  • Add support for scroll-margin-* and scroll-padding-*
  • Add support for @media (prefers-color-scheme: dark/light) media queries
  • Add support for mask-image
  • Add support for clamp
  • Add support for revert / revert-layer
  • Add support for aspect-ratio

Installation

  • Download and place the file(s) in a directory called TemplateStylesExtender in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'TemplateStyles' );
    wfLoadExtension( 'TemplateStylesExtender' );
    
  • Configure as required.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

Key Description Example Default
$wgTemplateStylesExtenderEnablePrefersColorScheme Flag to enable @media (prefers-color-scheme: dark/light) media queries false true
$wgTemplateStylesExtenderEnableCssVars Flag to enable css vars false true

Note 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>

See also

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy