Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

LinearGradient
Level 7
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
Sham_HC
Correct answer by
Level 10
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

0 Replies
alvawb1
Employee
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

Sham_HC
Correct answer by
Level 10
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

LinearGradient
Level 7
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.

Bruce_Lefebvre
Employee
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.

LinearGradient
Level 7
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.

MaxBarrass
Level 3
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

mateusp92385321
Level 2
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]"

AndreaG-mm
Level 1
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"]

 

kautuk_sahni
Community Manager
Community Manager
Thank you for sharing this with community.