Expand my Community achievements bar.

SOLVED

having multiple ClientLibs set up in the same app.

Avatar

Level 4

Hello guys, I am a bit familiar with the ClientLibs system but I've never seen this before so I'm curious if this is possible. I am on AEM 6.5 and I'm trying to set up two different ClientLibs on the same project, by this I will be able to configure an editable template by selecting a specific client lib. Do you know any example of this somewhere? I couldn't find any. Mostly I'm interested how the file structure will look like. Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 7

It is not required to be placed under clientlib-site. You can create a parallel client lib by name clientlib-A-site and keep you generic site specific code in clientlib-site and template specific to clientlib-A-site , clientlib-B-site. This is what i prefer, i dont think there is any where any best practice written on how to add another client lib. It is total based on your requirement.

If your code is a sub set of clientlib-site you can also create a clientlib inside clientlib-site but dont add it to js.txt or css.txt of clientlib-site and add this client lib through page policy option.

But its better to get views/suggestion from other community members as well.

View solution in original post

3 Replies

Avatar

Level 7

Hello,

You can have any number of client libs in your project. If you want to add different client library to different editable templates. Simply create one editable template and go to page policy of template. There you will see an option to add client library to specific template.

1816847_pastedImage_0.png

Avatar

Level 4

Hey @AnkurAhlawat, thanks for your answer. I understand such a thing is possible, my query is, how to include multiple clientLibs into my project. Under my project I have the following folder structure:

1816946_pastedImage_0.png

If I am going to add another library, where should that be placed, under the clientlib-site?

I think I'll have to study more about clientLibs.

Avatar

Correct answer by
Level 7

It is not required to be placed under clientlib-site. You can create a parallel client lib by name clientlib-A-site and keep you generic site specific code in clientlib-site and template specific to clientlib-A-site , clientlib-B-site. This is what i prefer, i dont think there is any where any best practice written on how to add another client lib. It is total based on your requirement.

If your code is a sub set of clientlib-site you can also create a clientlib inside clientlib-site but dont add it to js.txt or css.txt of clientlib-site and add this client lib through page policy option.

But its better to get views/suggestion from other community members as well.