3.3.2.1. Declaring an eXo Platform module

This part shows how to declare a module, and how the Highlight.js library is integrated into eXo Platform.

Note

The Highlight.js file is already integrated into eXo Platform.

The following example can be found among the eXo Platform examples in the amd-js.war. The Highlight.js is actually a jQuery plugin which is a perfect example as it is a natural eXo Platform module and follows the self-invoking pattern that consumes the jquery dependency as $. Here is an overview of the Highlight.js source:

(function($) {
          ...
}(jQuery)

It is integrated by using the XML declaration in gatein-resources.xml.


<module>
  <name>highlight</name>
  <script>
    <path>/highlight/highlight.js</path>
  </script>
  <depends>
    <module>jquery</module>
    <as>jQuery</as>
  </depends>
</module>

The module is named highlight and uses the /highlight/highligh.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.

Note

The jQuery 1.7.1 is built in eXo Platform.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus