Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Is there a way to disable JS minification for a particular clientlib or JS file?

Avatar

Level 7

The YUI Compressor cannot compress AngularJS as Angular has some methods such as int(...) that are considered to be reserved words by the YUI Compressor:

15.07.2014 15:32:58.341 *ERROR* [10.66.39.79 [1405402378150] GET /etc/designs/sitesmart/vendor/angular.min.46bb57e637db6fea063f889350401764.js HTTP/1.1] com.day.cq.widget.impl.HtmlLibraryManagerImpl Error during assembly of library. org.mozilla.javascript.EvaluatorException: Compilation produced 52 syntax errors.

You can reproduce the compression issue here: http://refresh-sf.com/yui/ (just upload the angular.js file).

In order to fix this issue, is there a way to skip minification for some specific JS files and/or clientlibs?

1 Accepted Solution

Avatar

Correct answer by
Level 10

OOB not possible & you might need to implement own HTMLLibraryManager.  File daycare requesting feature pack.

If you have taken look at [1] you can take advantage of selector and at dispatcher OR linkrewriter remove .min for your request.

[1]  http://aemfaq.blogspot.com/2013/05/whats-new-in-aem-html-library-manager.html

View solution in original post

9 Replies

Avatar

Employee

Hi LinearGradient,

AEM can handle minification automatically if you click the Minify checkbox in the Day CQ HTML Library Manager in the Web Console. See http://aem.matelli.org/client-library-configuration-minify-and-debug/

Regards,

Alva

Avatar

Correct answer by
Level 10

OOB not possible & you might need to implement own HTMLLibraryManager.  File daycare requesting feature pack.

If you have taken look at [1] you can take advantage of selector and at dispatcher OR linkrewriter remove .min for your request.

[1]  http://aemfaq.blogspot.com/2013/05/whats-new-in-aem-html-library-manager.html

Avatar

Level 7

Hi Alva,

Looks like my question was not clear enough.

I already have minification turned on, but CQ 5's minification library (YUI Compressor) has a known bug that makes it break when it tries to minify the angular.js library: https://github.com/yui/yuicompressor/issues/47

So the question is, is there a way to have minification turned on globally, but skip minification just for a particular clientlib?

Thanks.

Avatar

Employee

Hi LinearGradient,

I don't know of a way to exclude specific clientlibs from minification.

That said, I've worked around this bug by simply using the pre-minified version provided by Angular, which YUI has no problem minifying.

Avatar

Level 7

Bruce Lefebvre wrote...

Hi LinearGradient,

I don't know of a way to exclude specific clientlibs from minification.

That said, I've worked around this bug by simply using the pre-minified version provided by Angular, which YUI has no problem minifying.

 

Unfortunately I don't like this approach. Because double minifying makes it impossible to use Angular's source map file and makes debugging very hard.

Avatar

Level 3

You could always do this, just include a link to your client libs folder directory without using JSTL:

<link rel="stylesheet" href="https://forums.adobe.com/etc/clientlibs/aemdesign/clientlibs-common-head.css" type="text/css">

<script type="text/javascript" src="/etc/clientlibs/aemdesign/clientlibs-common-head.js"></script>

this will add the timstamp but wont minify

Avatar

Level 2

Change the minification engine for client libraries in AEM

According to the documentation above, you can change the minification engine for a specific clientlib on AEM version 6.2 and above.

Following up on that, to disable minification, you could add the following property and values to your clientlib .content.xml:

jsProcessor="[default:none, min:none]"

Avatar

Level 1

I just came to a similar problem today got the solution from this page https://helpx.adobe.com/au/experience-manager/kb/how-to-change-the-minification-engine-for-client-li...

 

 

You can add the following property to your client library folder and won't be minified.

jsProcessor: ["default:none", "min:none"]

 

Avatar

Administrator
Thank you for sharing this with community.


Kautuk Sahni