Load client libs with selection button | Community
Skip to main content
New Participant
January 24, 2024
Solved

Load client libs with selection button

  • January 24, 2024
  • 2 replies
  • 912 views

Hi,

I have created a button for which I would like to get loaded some js from clientlibs folder.
The clientlibs folder is created with some categories andcq:ClientLibraryFolder jcr:primaryType (screenshot 1) and containing the script universaleditor.js. The button "universaleditor" has the child "items" containing the node "clientlibs" with the categories of the clientlibs folder and sling:resourceType granite/ui/components/coral/foundation/includeclientlibs (screenshot 2).
The js from the client library folder is not loading in AEM when displaying the universaleditor button.
Can you please suggest why loading of js might fail?

Thanks,
Peter

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by pnagy

Hi @kautuk_sahni ,

yes, it is working at the end. I had 2 issues:
- missing js.txt file as suggested by @arunpatidar , thanks a lot for that

- the clientlib's category needed to be referred in the .content.xml's 

<jcr:content>

  <head>

     <clientlibs ..

tag, instead of adding it under the selection button clientlib tag (how I found it in some post it could work but it did not).
Js is loading now and I can use it for my purposes.

Thanks,
Peter

2 replies

kautuk_sahni
Employee
February 2, 2024

@pnagy Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni
pnagyAuthorAccepted solution
New Participant
February 2, 2024

Hi @kautuk_sahni ,

yes, it is working at the end. I had 2 issues:
- missing js.txt file as suggested by @arunpatidar , thanks a lot for that

- the clientlib's category needed to be referred in the .content.xml's 

<jcr:content>

  <head>

     <clientlibs ..

tag, instead of adding it under the selection button clientlib tag (how I found it in some post it could work but it did not).
Js is loading now and I can use it for my purposes.

Thanks,
Peter

arunpatidar
New Participant
January 24, 2024

Hi @pnagy 
You are missing js.tx file where you need to add universaleditor.js path

 

More info : https://medium.com/@toimrank/aem-clientlibs-css-and-js-6fda52c4e26f 

Arun Patidar
pnagyAuthor
New Participant
January 26, 2024

Hi @arunpatidar ,

right, I re-tried with js.txt but I still miss something.
I double check it.

Thanks,
Peter