Skip to main content
vasimakram
Level 4
Dec 9, 2015 1:06 PM UTC
Solved

How to install minified js files through maven in AEM CRXDE

How to install minified js files through maven in AEM CRXDE instead of going through Day CQ HTML Library Manager configuration ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Peter_Puzanovs
Peter_PuzanovsAccepted solution
Community Advisor
Dec 9, 2015 3:01 PM UTC

Hey Vasim,

You can switch and use alternative js minification tools.

gulp[1] or grunt[2] can be used to minify your js as part of maven build[3,4,5], this would give you and your devs more flexibility and have smaller size minified js files.

[1] http://gulpjs.com/

[2] http://gruntjs.com/

[3] https://github.com/allegro/grunt-maven-plugin

[4] https://github.com/eirslett/frontend-maven-plugin

[5] http://www.slideshare.net/ZoranNikolovski/making-maven-and-grunt-play-nice

Thanks,

Peter

6 replies

edubey
Level 10
Dec 9, 2015 1:51 PM UTC

Hi,

I presume that you are using Eclipse,

Use any external tool to convert to minify your existing js, once done copy and paste the content of js file under /etc/design/js-file-path and take the build

Translate
vasimakram
Level 4
Dec 9, 2015 2:25 PM UTC

I have 100 js files. I tried by turning minify to ON Day CQ HTML Library Manager configuration doing basic level minification. I want more minification. Is there any way?

Translate
edubey
Level 10
Dec 9, 2015 2:30 PM UTC

Two questions:

1. Which AEM Version you are referring?

2. Can you tell  what level of minification currently you have and wht more you are expecting?

Translate
vasimakram
Level 4
Dec 9, 2015 2:37 PM UTC

I am using AEM 5.6.1. It just removing spaces(as shown in image 1.png). I want something like in image (2.png).

Translate
Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
Dec 9, 2015 3:01 PM UTC

Hey Vasim,

You can switch and use alternative js minification tools.

gulp[1] or grunt[2] can be used to minify your js as part of maven build[3,4,5], this would give you and your devs more flexibility and have smaller size minified js files.

[1] http://gulpjs.com/

[2] http://gruntjs.com/

[3] https://github.com/allegro/grunt-maven-plugin

[4] https://github.com/eirslett/frontend-maven-plugin

[5] http://www.slideshare.net/ZoranNikolovski/making-maven-and-grunt-play-nice

Thanks,

Peter

Translate
kautuk_sahni
Level 9
Dec 11, 2015 4:22 AM UTC

HI

Just to add what Peter has said, A Grunt plugin to read AEM clientlibs js.txt and css.txt files to JSON for use with other grunt plugins. e.g. concat, less compilation, jslint, jasmine unit tests.

Reference links :-

Link:- https://www.npmjs.com/package/grunt-aem-clientlibs

Link:- http://adapt.to/2015/en/schedule/integrate-modern-frond-end-development-with-aem-sling.html (Presentation in the end)

Link:- http://www.slideshare.net/ZoranNikolovski/making-maven-and-grunt-play-nice

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Translate
Kautuk Sahni