Change the minification engine for client libraries in AEM

This article addresses the Adobe Experience Manager issue where you want use a different minification library for AEM client libraries other than the default YUI Compressor library. You may use the Google Closure Compiler (GCC); see through the client library nodes that use GCC for JS below.

Description description

Environment

Adobe Experience Manager 6.4, 6.5

Issue/Symptoms

How to use a different minification library for AEM client libraries than the default YUI Compressor library?

Resolution resolution

In AEM, you can swap out the YUI engine with GCC (Google Closure Compiler https://github.com/google/closure-compiler-js).

For example, see these client library nodes that use GCC for JS:

/libs/granite/contexthub/dependencies/coralui
/etc/clientlibs/granite/coralui3
/etc/clientlibs/granite/coralui2
/libs/dam/gui/coral/components/admin/adhocassetshare/clientlibs/adhocassetshare
/libs/dam/gui/components/admin/adhocassetshare/clientlibs/shareembedded
/etc/clientlibs/screens/player/shared
/etc/clientlibs/screens/player/firmware
/libs/dam/gui/components/admin/adhocassetshare/clientlibs/shareembeddedpreview
/apps/geometrixx-instore/clientlibs

Note:  If you want to implement your own custom script processor, then you would implement this Java interface:
com.adobe.granite.ui.clientlibs.script.ScriptProcessor

RELATED JAVADOC:

Interface ScriptProcessor

This allows you to define ScriptProcessors that can modify script sources:

  • the processors are configurable with options
  • the processor can be used for minification but also for non-minified cases

CONFIGURATION:

  • The default ScriptProcessors options can be set via the  HTML Library Manager OSGi configuration (in the /system/console/configMgr UI).

OPTIONS FOR GCC ARE:

  • failOnWarning (defaults to false)
  • languageIn (defaults to ECMASCRIPT5)
  • languageOut (defaults to ECMASCRIPT5)
  • compilationLevel (defaults to simple) (can be whitespace, simple, advanced)
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f