Manual:$wgResourceModules

Examples
Here's a basic example for usage in an extension. You'd put this in the main php file like

The above example will create a module called ' ', that includes the script, the style  , and so on. It also ensures two modules ' ' and ' ' are available before execution.


 * Advanced example in Extension:Vector

Details
By default modules are registered as an instance of ResourceLoaderFileModule. You find the according code in. Here is the documentation:


 * localBasePath
 * Base path to prepend to all local paths in $options. Defaults to $IP.
 * Base path


 * remoteBasePath
 * Base path to prepend to all remote paths in $options. Defaults to.
 * Base path


 * remoteExtPath
 * Equivalent of remoteBasePath, but relative to.
 * Base path


 * scripts
 * Scripts to always include.
 * File path string or array of file path strings.


 * languageScripts
 * Scripts to include in specific language contexts.
 * Array keyed by language code containing file path string or array of file path strings.


 * skinScripts
 * Scripts to include in specific skin contexts.
 * Array keyed by skin name containing file path string or array of file path strings.


 * debugScripts
 * Scripts to include in debug contexts.
 * File path string or array of file path strings.


 * loaderScripts
 * Scripts to include in the startup module.
 * File path string or array of file path strings.
 * WARNING: This parameter does not do what you think it does. Using   requires that you register your module before you can do anything else with it.  Specifying a script here will load the script in the header, but it will otherwise leave you with a crippled module.  See this bug for more information.


 * dependencies
 * Modules which must be loaded before this module.
 * Module name string or array of module name strings.


 * styles
 * Styles to always load.
 * File path string or array of file path strings.


 * skinStyles
 * Styles to include in specific skin contexts.
 * Array keyed by skin name containing file path string or array of file path strings.


 * messages
 * Messages to always load
 * Array of message key strings.


 * group
 * Group which this module should be loaded together with
 * Group name string.
 * See detailed documentation before using this.


 * position
 * Position on the page to load this module at.
 * 'bottom' (default) or 'top'.


 * class
 * Alternate subclass of ResourceLoader (rather than default ResourceLoaderFileModule). If this is used, some of the other properties may not apply, and you can specify your own arguments
 * Class name of alternate subclass


 * skipFunction
 * Function that returns true when the module should be skipped; intended for when the module provides a polyfill that is not required in modern browsers
 * Filename of a JavaScript file with a top-level return (it should not be wrapped in a function)

Loading module
See also ResourceLoader/Migration guide (developers):