Expand my Community achievements bar.

SOLVED

Minify JS CSS

Avatar

Former Community Member

Turning minify to ON using  com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl   is  doing ONLY basic minification. For example carriage return is not removed from CSS and JS

Even obfuscation is also basic.

If there a way to configure the YUI compressor that it uses with advanced parameters for more compression of the statis files (JS and CSS) ?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

You can get the jar file by following these steps- 

  1. Open http://localhost:4502/system/console/bundles/com.adobe.granite.ui.clientlibs
  2. Find the bundle Id on the page 
  3. Go to crx-quickstart/launchpad/felix/bundle<bundleid> folder. You will see bundle.jar in that folder. 

View solution in original post

11 Replies

Avatar

Level 2

What version are you using?  I see an known issue in the Release Notes for 6.0

"Client libs: When using the new 6.0 cachekey feature of the client library, minification is no longer applied to files (CQ-21506)"

Avatar

Former Community Member

I am using  6.0.  Its not that it isn't doing minification. 

It is but not doing advanced minification which YUI does.

Any suggestions would be highly appreciated...

 

Thanks

Avatar

Employee Advisor

AEM does use YUI compressor. Check the bundle JAR location of com.adobe.granite.ui.clientlibs bundles in crx-quickstart/launchpad/felix folder and you will find the YUI compressor JAR in it. 

Link to documentation - https://helpx.adobe.com/experience-manager/kb/upgrade-yui-compressor.html

Avatar

Former Community Member

I am using AEM 6.0 SP2 which already has latest YUI compressor

Question is how can configure the YUI compressor setting  in AEM ?

Please see the below link which documents things we can configure inYUI 

http://yui.github.io/yuicompressor/   

Does AEM have a way to configure these?

Avatar

Employee Advisor
I couldnt find any configuration or any documentation which specifies how to configure the compressor. You can see in the code below how AEM invokes the YUI compressor. //Signature of YUICompressor compress method public void compress(Writer out, Writer mungemap, int linebreak, boolean munge, boolean verbose, boolean preserveAllSemiColons, boolean disableOptimizations) //and AEM calls it like this compressor.compress(out, 0, true, false, false, false);

Avatar

Level 2

Is there a feature you are looking for that you want to enable in particular?  I can see in the code from the above referenced JAR that the YUI compressor is called with this method:

compress(Writer out, int linebreak, boolean munge, boolean verbose, boolean preserveAllSemiColons, boolean disableOptimizations)

with these parameters

compressor.compress(out, 0, true, false, false, false);

Avatar

Former Community Member

Are you looking in com.adobe.granite.ui.clientlibs-1.0.0.jar   ??

Could you upload the JAR file you are referring?

Avatar

Former Community Member

Are you looking in com.adobe.granite.ui.clientlibs-1.0.0.jar   ??

Could you upload the JAR file you are referring?

Avatar

Correct answer by
Employee Advisor

You can get the jar file by following these steps- 

  1. Open http://localhost:4502/system/console/bundles/com.adobe.granite.ui.clientlibs
  2. Find the bundle Id on the page 
  3. Go to crx-quickstart/launchpad/felix/bundle<bundleid> folder. You will see bundle.jar in that folder. 

Avatar

Level 2

In my CQ 5.6.1 instance it is com.adobe.granite.ui.commons-5.5.76.jar.  I don't have AEM 6.0 installed but if you read that KB article that kunal23 linked above you can find it in your 6.0 installation easy enough.

Avatar

Former Community Member

Thanks Kunal.

The line break argument should be passed -1 so that that the resultant minified file has no new line.

https://github.com/yui/yuicompressor/blob/master/src/com/yahoo/platform/yui/compressor/JavaScriptCom...

************************

if (linebreakpos >= 0 && result.length() - linestartpos > linebreakpos) {

    result.append('\n');

    linestartpos = result.length();

}

 

Have figured this out and now it is working