dev-master
9999999-dev https://www.mediawiki.org/wiki/Extension:SCSSUse SCSS files for MediaWiki styling
GPL-3.0-or-later
The Requires
extension mediawiki sass scss wiki
Use SCSS files for MediaWiki styling
The MediaWiki SCSS library provides a ResourceLoader module capable of compiling SCSS., (*2)
An SCSS module is defined much like any other style module. See the manual for
$wgResourceModules.
It should also be possible to add the module definition to the extension.json
of a MediaWiki extension. See
Developing_with_ResourceLoader, (*3)
Some additional keys may be used:
* class
:
This is mandatory. It selects the class to be used for the module. For
SCSS, the value has to be 'SCSS\\ResourceLoaderSCSSModule'
* styles
:
It is not an additional key, but it has extended semantics. This key
contains the list of the module's style files. Each file can optionally be
given a position to influence the order in which the files are compiled.
Allowed values for the position are
1. beforeFunctions
2. functions
3. afterFunctions
4. beforeVariables
5. variables
6. afterVariables
7. beforeMain
8. main
9. afterMain
, (*4)
If no position is given, `main` will be assumed. All files of one module will be compiled together, i.e., variables, mixins etc., will be shared between them.
variables
:
An array of variables and values to override the SCSS variables in the
style files. This allows changing values (e.g., colors, fonts, margins)
without having to modify the actual style files.cacheTriggers
:
Compiling SCSS is expensive, so compiled results are cached. This option
lists files that, when changed, will trigger flushing of the cache and
re-compiling of the style files., (*5)
All files on this list will be checked for each web request. To minimizes the load on the file system and the time to build the page, it is not advisable to add all style files to this list., (*6)
Here is an example definition:, (*7)
$wgResourceModules[ 'ext.MyExtension.styles' ] = [ 'class' => 'SCSS\\ResourceLoaderSCSSModule', 'localBasePath' => $localBasePath, 'remoteBasePath' => $remoteBasePath, 'position' => 'top', 'styles' => [ 'modules/ext.MyExtension.foo.scss' => 'main', 'modules/ext.MyExtension.bar.scss' ], 'variables' => [ 'red' => '#ff0000', 'green' => '#00ff00', 'blue' => '#0000ff', ], 'cacheTriggers' => [ 'LocalSettings.php', 'composer.lock', ], ];
The extension uses the scssphp/scssphp compiler, which has some limitations. See the issue list., (*8)
$egScssCacheType
can be set to request a specific cache type for the compiled
styles. To disable caching of SCSS styles altogether (e.g., during development),
set $egScssCacheType = CACHE_NONE;
. This should never be done on a production
site., (*9)
The SCSS extension is maintained by Professional Wiki. You can contract us to help you install or customize SCSS. We also do development work., (*10)
The tests can only be run when the library is loaded within MediaWiki.
You can add it via composer.local.json
(probably using dev-master
)., (*11)
Inside your MediaWiki root directory, (*12)
php tests/phpunit/phpunit.php -c vendor/mediawiki/scss/phpunit.xml.dist
You can use the SCSS extension under the GNU General Public License, version 3 (or any later version)., (*13)
Released on 2024-04-25, (*14)
scssphp
version from 1.10.2 to 1.12.1Released on 2022-07-25, (*15)
Released on 2022-03-30, (*16)
scssphp
version from 1.5.2 to 1.10.2Released on 2022-07-25, (*17)
Released on 2021-05-18, (*18)
scssphp
Released on 2021-05-15, (*19)
scssphp
below 1.5 to avoid breaking changesReleased on 2020-12-27, (*20)
Released on 2020-09-07, (*21)
scssphp
Released on 2020-09-07, (*22)
scssphp
to 1.1.1 to avoid the 1.2 bugReleased on 2020-04-19, (*23)
scssphp
Released on 2019-04-28, (*24)
Use SCSS files for MediaWiki styling
GPL-3.0-or-later
extension mediawiki sass scss wiki