Custom Resources

Arbitrary files can be included in the web application by doing the following:

  1. At the root of a component, created a folder called WebContent, for example <client-dir>/components/MyComponent/WebContent.
  2. Place files in this folder using any folder structure you wish.
  3. When you run the client build target these files will be copied directly to the <client-dir>/WebContent which represents the root of the web application. The folder structure will be maintained during the copy.
warning:

Before making use of this functionality care should be taken to understand the effects. It is advised to firstly view the generated WebContent folder (located webclient/WebContent) and to be aware of what files exist in it. Placing a similar file in the WebContent folder of a component will overwrite the currently existing file in the generated WebContent folder.

Files included in the application in this way take precedence over the merging and overriding process as described in previous sections for other resources. For example, if you include a CSS file in this way, the contents of the file will not be included in the CSS overriding process described in Cascading Stylesheets.

The copying of custom resources occurs after other source artifacts are built and merged, so it is possible to replace existing resources. Care should be taken in this case. For example, it would be possible to have a component with a file in WebContent/WEB-INF/struts-config.xml that would completely replace the Struts configuration file generated by the client build and therefore break the application.

It is also important to note that the files placed in a WebContent folder within a component are completely ignored during the build process and are not processed. They are merely copied across. For example, if you have JavaScript properties file in the WebContent folder of your component it will not be processed.

Finally, when multiple components have a WebContent folder they are copied based on component priority, but the copy is time-stamp based. The copy command always uses verbose output for these files so the developer can see exactly what files are being copied.