How to Use The Google Closure Compiler with AEM 6.2+

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”
    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
    Google Closure Compiler Clientlib Config
  5. Voila!

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

About the Author

Ahmed is an Adobe Technical Lead and expert in the Adobe Experience Cloud.

More from this Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up