Is there a way to disable JS minification for a particular clientlib or JS file? | Community
Skip to main content
LinearGradient
Level 6
October 16, 2015
Solved

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

  • October 16, 2015
  • 8 replies
  • 12879 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

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

8 replies

Community Manager
October 16, 2015

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
Sham_HCAccepted solution
Level 10
October 16, 2015

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

LinearGradient
Level 6
October 16, 2015

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.

Adobe Employee
October 16, 2015

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 6
October 16, 2015

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
November 28, 2017

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
May 25, 2018

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]"

July 21, 2020

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-libraries-in-AEM.html

 

 

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
July 22, 2020
Thank you for sharing this with community.
Kautuk Sahni