Help:Including additional CSS and JS

You can use the global JavaScript method  to include articles containing scripts or styles on your wiki that are not included by default. This method will work with local articles (such as "MediaWiki:Wikia.js") or external articles (such as "w:c:dev:Mediawiki:External_include.js" -- see Interwiki Links for more information). Using this method will combine all of the articles you need into one request and minify them. This will reduce file size and web traffic to help make your wiki faster.

Be aware that this will not work for inter-language links. If you want to import w:c:it.onepiece:MediaWiki:Common.js/togglers.js for example, it will fail. See Interlanguage Links to workaround this.

Usage
To use this method, you will need to provide an options object containing the type of articles to include (either "script" or "style") and an array of article names.

For example, if you wanted to import two JavaScript articles, one from the local wiki and one from an external wiki, your code would look something like this:

Likewise, if you wanted to include two Stylesheet articles, one from the local wiki and one from an external wiki, your code would look something like this:

If you only need to include one file, you may use this alternate syntax:

Most users will probably want to include both "script" and "style" in the same JavaScript article. To do so, you must make separate declarations, like so:

Interlanguage Links
does not fully implement the interwiki link behaviours. It can't handle any links that have dots in the name, you can usually (but not always) work around this problem by just leaving the dot out: Be aware that this problem also affects Answers wikis and any other Wiki that has multiple subdomains: w:c:onepiece.answers will not work either, you need to use ' '.

Advanced Usage
is mainly a convenience function. Its job is to build a proper URL, perform sanity checks and provide you with error messages. But you do not truly need  to build the URL. You can do so yourself.

The URLs look like this:

The ResourceLoader is a complex beast and there are a few parameters you might want to add but these ones are essential:

You could use such an URL in an @import rule in a CSS file:

or with jQuery.getScript in a JS file:

Using importArticles in global script files
If you want to speed up your w:Special:Mypage/global.js or w:Special:Mypage/wikia.js or w:Special:Mypage/monobook.js with, you will face a little problem: A lot of the wikis you'll visit will have already been updated to MediaWiki 1.19.1. But some may not have been updated yet and  will be.

As a workaround you could add a pseudo-version of  that will be used if the real thing is unavailable:

Known Glitches
cannot interwiki import from the same Wiki you are already on. As such, you are advised NOT to use  in your   unless you are willing to code around this problem (you must automatically convert interwiki links to a local wiki link when you are on that wiki).

de:Hilfe:Einbinden mehrerer JavaScript oder CSS Dateien es:Ayuda:Incluyendo JavaScript y CSS adicional fr:Aide:Inclure JavaScript et CSS supplémentaire it:Aiuto:Includere JavaScript e CSS addizionali nl:Help:Bijkomende JavaScript en CSS laden