January 2, 2021
Estimated Post Reading Time ~

How to Use The Google Closure Compiler with AEM

The Google Closure Compiler was added to AEM in version 6.2 as a new script compiler bundle. This means that AEM can now use the Closure Compiler to code-check and minify JavaScript instead of using the YUI Compressor, which is buggy and was last released on 07/03/2013 (at the time of this post).

To check if the Closure Compiler bundle is installed, go to Bundles /system/console/bundles and search for “Google Closure Compiler.”

Here is how you can make Closure Compiler the default minifier in AEM:
1. Go to Apache Felix Config Manager: /system/console/configMgr
2. Search for “Adobe Granite HTML Library Manager”


3. Open the config and make sure “minify” is enabled
4. Set the field “JS Processor Default Configs” to “min:gcc” or “min:gcc;obfuscate=true” to enable obfuscation


5. Voila!

You can subscribe to our weekly digest at the bottom of the page for more AEM tips and tricks.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.