How us load script on page | Community
Skip to main content
Level 2
October 12, 2020
Solved

How us load script on page

  • October 12, 2020
  • 1 reply
  • 842 views

Hi,

     Someone please le me know how we can load script file before loading script of component level.

 I have embed my component level js (categories name in parent clientlibfolder where i have added my slick script by using embed ) but while loading the page it is loading the component level code not the parent level slick script.

 

 >  Inside the parent clientlib folder

categories                                      string                                   homepage

embed                                            string[]                                 homepage.homepagebanner

jcr:primaryType                              Name                                  cq:ClientLibraryFolder

 

  >  Component level clientlib folder

  categories                                      string                                   homepagebanner

  jcr:primaryType                              Name                                  cq:ClientLibraryFolder

 

 

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 ChetanyaJain-1

@shashanks526115

The embed property is NOT transitive – If Clientlib A embeds Clientlib B which embeds Clientlib C, then only Clientlib A and B will be included in the page. Clientlib A and B will be combined into one CSS and JS files as well. In order to include Clientlib C, it must be added to the embed property of Clientlib A as well.

Use dependencies instead of embed. Also, with dependencies, the dependent library will be loaded first.

Hope this helps!

1 reply

ChetanyaJain-1
Community Advisor
ChetanyaJain-1Community AdvisorAccepted solution
Community Advisor
December 5, 2022

@shashanks526115

The embed property is NOT transitive – If Clientlib A embeds Clientlib B which embeds Clientlib C, then only Clientlib A and B will be included in the page. Clientlib A and B will be combined into one CSS and JS files as well. In order to include Clientlib C, it must be added to the embed property of Clientlib A as well.

Use dependencies instead of embed. Also, with dependencies, the dependent library will be loaded first.

Hope this helps!