DocumentationAEM 6.5User Guide

Minification of the JavaScript files

Last update: May 22, 2024
  • Applies to:
  • Experience Manager 6.5
  • Topics:
  • Adaptive Forms

CREATED FOR:

  • User
  • Developer

Minification removes from the source code the redundant characters, such as white space, new lines, and comments. This improves the performance by reducing the size of the code. While minification does not impact the functionality, it reduces the readability of the code.

To generate minified code for semantic changes, follow these steps.

  1. Copy client-html/src/main/webapp/js from src-package on filesystem.

    NOTE
    See Introduction to Customizing AEM Forms workspace for more details about the packages.
  2. Update paths in main.js located under client-html/src/main/webapp/js, for added/updated models/views.

    For example, the addition of a new Sharequeue model, say mySharequeue, change:

    sharequeuemodel : pathprefix + 'runtime/models/sharequeue',
    

    To

    
    sharequeuemodel : pathprefix + 'runtime/myModels/mySharequeue',
    
  3. Update registry-config.xml, located at client-html/src/main/webapp/js/resource_generator, in case there is change/addition of alias in main.js.

    For example, the addition of a new Sharequeue model, say mySharequeue, change:

    <sharequeue
                name="sharequeue"
                path="runtime/models/sharequeue.js"
                service="service"/>
    

    To

    
    <sharequeue
                name="sharequeue"
                path="runtime/myModels/mySharequeue.js"
                service="service"/>
    
  4. At client-html/src/main/webapp/js/minifier, run command:

    mvn clean install
    

    It generates a minified-files folder, under client-html/src/main/webapp/js with minified main.js and registry.js.

NOTE
Minification only works on a 64-bit JVM.
NOTE
If you minify, your upgrade is impacted.
recommendation-more-help
19ffd973-7af2-44d0-84b5-d547b0dffee2