Minification of the JavaScript files minification-of-the-javascript-files
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.
-
Copy
client-html/src/main/webapp/js
from src-package on filesystem.note note NOTE See Introduction to Customizing AEM Forms workspace for more details about the packages. -
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:
code language-javascript sharequeuemodel : pathprefix + 'runtime/models/sharequeue',
To
code language-javascript sharequeuemodel : pathprefix + 'runtime/myModels/mySharequeue',
-
Update
registry-config.xml, located at client-html/src/main/webapp/js/resource_generator,
in case there is change/addition of alias inmain.js
.For example, the addition of a new Sharequeue model, say mySharequeue, change:
code language-xml <sharequeue name="sharequeue" path="runtime/models/sharequeue.js" service="service"/>
To
code language-xml <sharequeue name="sharequeue" path="runtime/myModels/mySharequeue.js" service="service"/>
-
At client-html/src/main/webapp/js/minifier, run command:
code language-shell mvn clean install
It generates a minified-files folder, under client-html/src/main/webapp/js with minified main.js and registry.js.