Expand my Community achievements bar.

SOLVED

How us load script on page

Avatar

Level 2

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

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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!

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@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!