Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Difference between Embed and Dependencies

Avatar

Level 3

When should we use embed and when to use dependencies in Clientlibs. Which one is better? Can someone please answer this in simple terms and some real time scenarios to understand the same?

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @Shivam153 ,

 

The main difference is in terms of requests being made to the server.

 

dependencies should cause your page to have extra requests to other clientlibs (external "subscribe")

embed should "aggregate" those other clientlibs INTO the current clientlib (internal subscribe)

 

There is no better here, as it depends on your use case, it's an architecture choice.

 

Here you can find great details about them:-

https://khakiout.wordpress.com/2016/02/23/aem-clientlibs-difference-between-dependencies-and-embed/ 

 

https://stackoverflow.com/questions/13052261/what-is-the-difference-between-embed-and-dependencies-f...

 

Hope this helps!

 

Regards,

Nitesh

View solution in original post

3 Replies

Avatar

Correct answer by
Employee

Hi @Shivam153 ,

 

The main difference is in terms of requests being made to the server.

 

dependencies should cause your page to have extra requests to other clientlibs (external "subscribe")

embed should "aggregate" those other clientlibs INTO the current clientlib (internal subscribe)

 

There is no better here, as it depends on your use case, it's an architecture choice.

 

Here you can find great details about them:-

https://khakiout.wordpress.com/2016/02/23/aem-clientlibs-difference-between-dependencies-and-embed/ 

 

https://stackoverflow.com/questions/13052261/what-is-the-difference-between-embed-and-dependencies-f...

 

Hope this helps!

 

Regards,

Nitesh

Avatar

Level 5

embed - This defines the categories which will be combined to the current clientlib. AEM will merge all clientlibs into the current clientlib. This is usually used for minimizing requests and for accessing clientlibs which are not supposed to be exposed to public.

 

Used to embed code from other libraries. If node F embeds nodes G and H, the resulting HTML will be a concetration of content from nodes G and H.

 

dependenciesThis defines the other categories that the current clientlib depends upon. The dependencies will be included in the page along with the dependent clientlib. This property is transitive – if Clientlib A depends on Clientlib B which depends on Clientlib C, then all clientlibs will be included in the page.

 

Which one to use , it depends on the use case .

 

 

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now