How can I change the default compressor library from YUI in CQ 5.4 | Community
Skip to main content
mark_brouch
October 16, 2015
Solved

How can I change the default compressor library from YUI in CQ 5.4

  • October 16, 2015
  • 4 replies
  • 2040 views

When minifying javascript using the Day CQ HTML Library Manager in the Apache Felix console, how can I change the library used for compressing? The default is the YUI compressor library, which has long since been deprecated (http://www.yuiblog.com/blog/2012/10/16/state-of-yui-compressor/) and does not have the minification ability of other more modern compressors such as Uglify.js.

What would be the best approach for setting up CQ to use Uglify.js as the compressor library in the same fashion that it currently uses YUI compressor?

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 Peter_Puzanovs

Hi Mark,

It really depends on yours projects complexitiy and your clientlibs usage. E.g. basic clientlibs JS concat api can be implemented easily.

1) Create a custom tag <new-tags:marks-tag name="custom-clientlibs" />

2) Create a service that will be invoked by this tag

3) Inside the service invoke a search for that particlular clientlibs by it's name

4) Read the content file and copy the files from the jcr in correct order to one big file and save it in memory

5) Push memory into some local file and run Uglify on it

6) Upload your newly generated file into the jcr clientlibs folder

7) Write the location of your compacted file in the jsp

Impl may vary depending on your CQ clientlibs usage.

Peter

4 replies

Sham_HC
Level 10
October 16, 2015
Peter_Puzanovs
Community Advisor
Community Advisor
October 16, 2015

Hey Mark,

CQ is easily extendable, essentially we had similar problem, so what we did:

1) Change the bundle to hold latest version of YUI.(Change the manifest and bundle in the latest YUI)

2) Upload the bundle back to the server.

 

CQ.5.6.1 already has the latest compressor(so, you might be doing dummy work, simply upgrade)

Thanks,

Peter

mark_brouch
October 16, 2015

Hi Peter,

Unfortunately, upgrading CQ is not an option - I'm stuck with 5.4. Thanks for your advice on upgrading YUI, however that doesn't solve the initial issue I raised of it no longer being supported or developed. What I'm actually looking to do is replace it with a modern supported minifier such as Uglify.js. Do you have any solutions to that end?

Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
October 16, 2015

Hi Mark,

It really depends on yours projects complexitiy and your clientlibs usage. E.g. basic clientlibs JS concat api can be implemented easily.

1) Create a custom tag <new-tags:marks-tag name="custom-clientlibs" />

2) Create a service that will be invoked by this tag

3) Inside the service invoke a search for that particlular clientlibs by it's name

4) Read the content file and copy the files from the jcr in correct order to one big file and save it in memory

5) Push memory into some local file and run Uglify on it

6) Upload your newly generated file into the jcr clientlibs folder

7) Write the location of your compacted file in the jsp

Impl may vary depending on your CQ clientlibs usage.

Peter