Manual:$wgResourceModules/zh
ResourceLoader: $wgResourceModules | |
---|---|
Array of all extra defined modules that can later be loaded during the output. |
|
引进版本: | 1.17.0 (r72349) |
移除版本: | 仍在使用 |
允许的值: | (multi-dimensional array) |
默认值: | [] |
其他设置: 按首字母排序 | 按功能排序 |
Examples
Below is an example of how to use this in an extension.
You would put this in your extension.json
file.
"ResourceModules": {
"ext.MyExtension": {
"localBasePath": "modules/ext.MyExtension",
"remoteExtPath": "MyExtension/modules/ext.MyExtension",
"styles": [
"foo.css",
"bar.css"
],
"packageFiles": [
"index.js",
"foo.js"
],
"messages": [
"myextension-foo-label"
],
"dependencies": [
"jquery.cookie",
"mediawiki.util"
]
}
},
Options
参见MainConfigSchema::ResourceModules。
Loading module
Note
If you require a list of all registered modules, it is not recommended to call $GLOBALS[ 'wgResourceModules' ]
from a skin or extension. The list may not be complete at the time of the request. See ResourceLoader::getModuleNames() instead.
See also
- ResourceLoader
$wgResourceModules
- Register modules that can later be loaded on a page$wgResourceModuleSkinStyles
- Register skin-provided stylesheets to add to an existing ResourceLoader module$wgResourceLoaderDebug
- Configure the default debug mode for MediaWiki.- Internal configuration settings:
$wgExtensionAssetsPath
,$wgResourceLoaderMaxage
- ResourceLoaderRegisterModules hook
- Developing with ResourceLoader – Learn how to use ResourceLoader in MediaWiki