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?
Solved! Go to Solution.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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?
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies