Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to use Google Closure Compiler (GCC) in AEM

Avatar

Level 3

Hey everyone, new to the forum here. I wanted to share an internal talk I did in my company about using Google Closure Compiler (GCC) in AEM. Hope you enjoy!!! Let me know if you have any questions or feedback.

Google Closure Compiler in AEM - YouTube

6 Replies

Avatar

Level 10

Thank you for posting this great community content! We will mark as Featured Content!

Avatar

Administrator

This is an excellent community content!! Thanks for sharing it!!



Kautuk Sahni

Avatar

Level 4

So the presentation describes that the min:gcc is built into AEM 6.2.  When I fired up my 6.3 environment and looked at Library Manager it still is using min:yui.  Is this an oversight or a preferred default for migrated systems?

Avatar

Level 3

Bob, that's correct. Someone at Adobe can correct me if I'm wrong, but I imagine it is a preferred default because they didn't want to surprise anyone. If you are migrating, you probably want to leave it alone, unless you want to enable your FE devs to write newer JavaScript.

Avatar

Level 1

That's a very helpful talk on GCC thanks for that, Is it still the case though with GCC? does it still not support CSS minification/compression?

Default YUI compression for CSS is causing a strange issue in our project whenever a build deployed pages don't respond at all for quite a while, when I looked at the error log and in the thread dump it showed an error at line where we included a headlib script with our CSS client lib in it. HtmlLibraryManagerImpl is quite a bit of time to build the CSS lib with YUI when switched to GCC it's almost instant please look at the log below. so I just tried setting the compressor to GCC for CSS and it worked I no longer see the issue and pages load immediately after the deployment. Can someone from Adobe confirm if GCC is wokring here even for CSS? or it's just skipping YUI? If it's skipping what's really minifying it? because I see the info log sayting minified even when used GCC.


With YUI:

01.06.2020 19:18:31.968 INFO [0:0:0:0:0:0:0:1 [1591019311637] GET /content/test/pixel.910-005768.html HTTP/1.1] com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl Start building CSS library: /apps/testing/clientlibs/testing-pagelibs (minified)
01.06.2020 19:19:31.639 INFO [oak-repository-executor-1] com.adobe.granite.repository Service [20071, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED
01.06.2020 19:19:31.641 INFO [oak-repository-executor-1] com.adobe.granite.repository Service [20072, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED
01.06.2020 19:19:31.642 INFO [oak-repository-executor-1] com.adobe.granite.repository Service [20073, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED
01.06.2020 19:19:31.652 INFO [oak-repository-executor-1] com.adobe.granite.repository Service [20074, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED
01.06.2020 19:19:31.691 INFO [oak-repository-executor-1] com.adobe.granite.repository Service [20075, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED
01.06.2020 19:19:31.968 INFO [oak-repository-executor-1] com.adobe.granite.repository Service [20076, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED
01.06.2020 19:30:11.447 INFO [0:0:0:0:0:0:0:1 [1591019311637] GET /content/test/pixel.910-005768.html HTTP/1.1] com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl finished building library /apps/testing/clientlibs/testing-pagelibs.css ** **

With GCC:

02.06.2020 20:17:09.697 INFO [0:0:0:0:0:0:0:1 [1591109229433] GET /content/test/pixel.910-005768.html HTTP/1.1] com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl Start building CSS library: /apps/testing/clientlibs/testing-pagelibs (minified)
02.06.2020 20:17:09.727 INFO [0:0:0:0:0:0:0:1 [1591109229433] GET /content/test/pixel.910-005768.html HTTP/1.1] com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl finished building library /apps/testing/clientlibs/testing-pagelibs.css 

Avatar

Level 3

Hi,

 

Tried following the steps mentioned in the youtube link .. still our clientlib is not getting minified.

Please note : we are using const & let keywords in our customized code due to this yui compressor is unable to minify js files:

Screen Shot 2021-08-16 at 2.24.30 PM.pngScreen Shot 2021-08-16 at 2.29.46 PM.png