Download the PHP package mwstake/mediawiki-component-thirdpartyresources without Composer
On this page you can find all versions of the php package mwstake/mediawiki-component-thirdpartyresources. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mwstake/mediawiki-component-thirdpartyresources
More information about mwstake/mediawiki-component-thirdpartyresources
Files in mwstake/mediawiki-component-thirdpartyresources
Package mediawiki-component-thirdpartyresources
Short Description Provides ResourceLoader module definitions that allow for inclusion of third-party pre-compiled resources (JS/CSS)
License GPL-3.0-only
Informations about the package mediawiki-component-thirdpartyresources
MediaWiki Stakeholders Group - Components
ThirdPartyResources for MediaWiki
Provides ResourceLoader module definitions that allow for inclusion of third-party pre-compiled resources (JS/CSS).
This code is meant to be used within the MediaWiki framework. Do not attempt to use it outside of MediaWiki.
Use in a MediaWiki extension
Add "mwstake/mediawiki-component-thirdpartyresources": "~1.0"
to the require
section of your composer.json
file.
Explicit initialization is required. This can be archived by
- either adding
"callback": "mwsInitComponents"
to yourextension.json
/skin.json
- or calling
mwsInitComponents();
within you extensions/skins customcallback
method
See also mwstake/mediawiki-componentloader
.
Optional: Setting up package.json
In MediaWiki extensions/skins, the package.json
is usually just used for CI tasks, like eslint
. Therefore one usually has only the "devDependecies"
entry and the node_modules/
directory is excluded from source code management e.g. via .gitignore
.
If npm
is used to pull in actual dependenies, it is recommended to copy the "dist" file(s) into the resources/
(or modules/
) directory of the extension/skin. This can easily be done by a scripts.postinstall
entry.
Example package.json
Setting up the ResourceLoader module
MediaWiki ResourceLoader may corrupt pre-packaged JS/CSS files, as it applies "minification". Also it may lack a proper module.exports
statement, to make the third party code available to the consuming code.
To overcome such issues, use the "class"
property of the "ResourceModule"
definition like this:
If a special module.exports
is required, it can be specified in the "module.exports"
property.