Board Thread:JS Development/@comment-25364614-20190731104503

This is a follow on from a thread in the Community Central. Long story short:
 * I wanted to customize the syntax highlighting on my local wiki.
 * The JS scripts for syntax highlighting were found on github:
 * WikitextSyntaxHighlighter.js - a module which defines all the complicated regex functions to read and parse the text in the editor area
 * Custom version saved as MediaWiki:CustomSyntaxHighlighter/module.js
 * WikitextSyntaxHighlighterQueueInit.js - a jquery script in which you can set the individual colours that the module references and re/initialize the highlighting
 * Custom version saved as MediaWiki:CustomSyntaxHighlighter/query.js

What I believe is happening is that the wiki initially loads the github scripts on the back end. Then (assuming the custom scripts are in common/wikia.js) the custom scripts overwrite the module and reinitialize the highlighting with the updated rules.

I have confirmed that when the custom scripts are directly pasted into common/wikia.js, the custom syntax highlighting works as intended.

However, if even one of the custom scripts is instead imported using  or , the custom syntax highlighting does not work.

I'm assuming this has something to do with the load order for js scripts.

As it is more ideal for the sake of neatness that the js scripts are imported into the common/wikia.js space, is there any way around this? Or should I be satisfied that I've even got it working at all? 