This part takes the Highlight.js library as an example to show you how to declare an eXo Platform module. This library is actually a jQuery
plugin which follows the self-invoking pattern that consumes the jquery dependency as $. Here is an overview of the Highlight.js source:
(function($) {
...
}(jQuery)Assume that you have added it to the javascript folder in your extension, and now declare this module using the XML declaration in /WEB-INF/gatein-resources.xml as follows:
<module>
<name>highlight</name>
<script>
<path>/javascript/highlight/highlight.js</path>
</script>
<depends>
<module>jquery</module>
<as>jQuery</as>
</depends>
</module>
The module is named highlight and uses the /javascript/highlight/highlight.js source code bundled in the war file.
The depends tag creates a dependency on the jquery module. The dependency is aliased as jQuery using the as tag to match the $ argument of the Highlight.js self-executing function. Refer here to check which jQuery versions are provided in eXo Platform.