Javascript Files

The Widget Framework includes a custom resource transformer for Javascript files called com.escenic.framework.transformers.JavaScriptFileMerger. This transformer is run as part of the standard publication build process. It merges all the Javascript files in your publication project together with all the Javascript files in the WAR files your publication depends on into one file, for performance reasons.

By default, JavaScriptFileMerger is configured to:

  • Look for Javascript files in your webapp's jscripts/ folder.

  • Generate a merged output file called wf-site.js.

Note, however, that JavaScriptFileMerger also leaves the original files in their original location, so that they are available for debugging purposes.

All you have to do to make use of this step in the build process, therefore, is make sure that you put all your publication's Javascript files in the webapp's jscripts/ folder. They will then automatically be included in the merged wf-site.js. file in alphabetic order of their file names.

Using a merged Javascript file offers the best performance for production purposes. During development, however, it is usually preferable to use the original individual Javascript files. You can force a publication to use your original Javascript files by setting the following section parameter in your publication's root section:

wf.scriptload.devmode=true

Widget framework ships with requirejs. So you can also load files using requirejs.