Expand my Community achievements bar.

SOLVED

RequireJS and ClientLibs - AEM 5.6

Avatar

Level 2

Hi All,

I have been hearing from teams that requireJS and Client Libs cannot go together. Can someone please explain that why is it so? What is that does not let these work together?

What is the best practice or high level approach if we have to use AMD style or RequireJS type of implementation in AEM?

Appreciate your attention and responses

Thanks,

Nitin

1 Accepted Solution

Avatar

Correct answer by
Level 9

There is a github project on using cq5 with requirejs. Please review this

https://github.com/yaycmyk/CQ5-RequireJS

View solution in original post

4 Replies

Avatar

Correct answer by
Level 9

There is a github project on using cq5 with requirejs. Please review this

https://github.com/yaycmyk/CQ5-RequireJS

Avatar

Level 2

Thanks. Looking at this GitHub example it seems that we need to provide a crx property at the component or template level and then the headlibs.jsp would read and load the same. This example is good as it still does not clutter the template with unnecessary inclusions of JS and will only load the ones which are a part of components included in a page.

Can you please throw some light on a scenario where client libs can be used along with requireJS?

Thanks,

Nitin

Avatar

Level 2

Thanks Scott. This is good as well.

In your experience do you recommend any best practice or use cases where we should use requireJS and clientlibs in AEM paradigm and yet use the beauty of clientlibs?  Your points/insights greatly appreciated

Thanks,

Nitin