Clientlib issue | Community
Skip to main content
Level 6
Jan 25, 2021 3:03 PM UTC
Solved

Clientlib issue

I have an existing component that has clientlib with category "abc" (suppose). I added a validation for a dialog field and created this clientlib outside the folder of my component and the named the category as "xyz".

I have added xyz in the category as well as the dependency of my component clientlib (abc), but still my js files doesn't load. Whereas, in the dialog of my component if I used 'granite include-clientlib' node and add category xyz in that node, then my js loads.

/apps-->clientlib(xyz)

/apps-->mycomp-->clientlib(abc)

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Anudeep_Garnepudi
Anudeep_GarnepudiAccepted solution
New Participant
Jan 26, 2021 6:24 AM UTC

@shaheena_sheikh 

If clientlib xyz contains Dialog related js/css then use includeclientlibs.

  1. You won't be able to see this clientlib being loaded on editor page unless until you open the dialog at least once.
  2. Very specific to editor mode

If clientlib xyz contain rendering related js/css then include it in template or component.

  1. You will not see this clientlib loading on editor page directly, because the page will be loaded in iframe.
  2. clientlib xyz will not interact with editor page, as it loads in iframe

5 replies

VeenaVikraman
New Participant
Jan 26, 2021 5:08 PM UTC

@shaheena_sheikh What I understood from your requirement is that , you have to load some JS specifically for authoring dialog alone. If that is the case I think the best way to do so is to use the extraClientLibs property in the dialog node

 

Check this https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/could-you-please-explain-what-is-extraclientlibs/qaq-p/197623

 

Thanks

Veena ✌

Translate
Anudeep_Garnepudi
Anudeep_GarnepudiAccepted solution
New Participant
Jan 26, 2021 6:24 AM UTC

@shaheena_sheikh 

If clientlib xyz contains Dialog related js/css then use includeclientlibs.

  1. You won't be able to see this clientlib being loaded on editor page unless until you open the dialog at least once.
  2. Very specific to editor mode

If clientlib xyz contain rendering related js/css then include it in template or component.

  1. You will not see this clientlib loading on editor page directly, because the page will be loaded in iframe.
  2. clientlib xyz will not interact with editor page, as it loads in iframe
Translate
kautuk_sahni
Employee
Jan 27, 2021 12:11 PM UTC
@anudeep_garnepudi, nice reply. Thank you.
Translate
Kautuk Sahni
BrianKasingli
New Participant
Jan 25, 2021 4:41 PM UTC

@shaheena_sheikh,

If you are trying to create a client library for its sole purpose, to add behavior to the Touch UI dialogues, I suggest you create a new client library just for its single responsibility. 

As an example:

 

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:ClientLibraryFolder" allowProxy="{Boolean}true" categories="[cq.authoring.editor.hook]" dependencies="[cq.authoring.editor.core]"/>

Documentation can be found here, https://experienceleague.adobe.com/docs/experience-manager-64/developing/extending-aem/customizing-page-authoring-touch.html?lang=en#add-new-layer-mode

 

Translate
Level 6
Jan 26, 2021 6:09 AM UTC
if i create a clientlib for dialogs only then if i include those clientlib through the granite-include-clientlib node, will the other clientlib that belongs to my component wont get discarded right?
Translate