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:
- Go to Apache Felix Config Manager: /system/console/configMgr
- Search for “Adobe Granite HTML Library Manager”
- Open the config and make sure “minify” is enabled
- Set the field “JS Processor Default Configs” to “min:gcc” or “min:gcc;obfuscate=true” to enable obfuscation
- Voila!
You can subscribe to our weekly digest at the bottom of the page for more AEM tips and tricks.