Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between embed[] and dependencies[] for type ClientLibraryFolder?

Tags:

I have tried to add multiple categories to embed[] and dependencies[] interchangeably many times. But I always see a dependency resolution error in JavaScript on the website.

Also, How do I specify the order of categories in a multiple value entry like embed[]? Is there any way we can control the order the JavaScript source that is loaded during the launch of website?

like image 469
exception Avatar asked Oct 24 '12 15:10

exception


People also ask

What is difference between embed and dependency in AEM?

The difference between those two concepts is that dependencies lead to additional includes/requests, while embeds are contained in the original client library's response (i.e. are concatenated with the JS/CSS of the client library itself).

What are dependencies in AEM?

Defines Maven dependencies for a specific AEM version, including those that are not defined in the AEM API JAR provided by Adobe. Additionally, the POM includes Sling-internal dependencies required for AEM Mocks in exactly the versions included in the AEM version.

What are clientLibs in AEM?

Clientlibs or Client libraries in aem is one of the most widely used features provided by Adobe, it allows us to not only manage our client side resources like ( JavaScript, CSS, images, fonts etc ), but also provide options to debug, minify,merge and gzip the client-side code.

What is the main purpose of the categories property in the Clientlibrary?

categories : Identifies the categories into which the set of JS and/or CSS files within this cq:ClientLibraryFolder fall. The categories property, being multi-valued, allows a library folder to be part of more than one category (see below for how this may be useful).


1 Answers

categories is the list of identifiers to publish a clientlib under.

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)

both properties can have multiple values, and the CRXDE Lite interface allows changing the order of items in the value list.

Given Clientlibs:

  • /etc/clientlibs/depA categories=["depA"]
  • /etc/clientlibs/depB categories=["depB"]
  • /etc/clientlibs/depC categories=["depC"]
  • /etc/clientlibs/useA categories=["useA"], dependencies=["depA", "depB"]
  • /etc/clientlibs/useB categories=["useB"], embed=["depB", "depC"]

If a page uses "useA" <cq:includeClientLib categories="useA"/>, then the HTML should have requests for depA, depB, useA (through their appropriate urls, ie /etc/clientlibs/depA.css

If a page uses "useB" <cq:includeClientLib categories="useB"/>, then the HTML should have only a request for useB. The contents of /etc/clientlibs/useB.css would be the concatenation of contents of depB, depC, useB.

The library manager at {localhost}/system/console/configMgr/com.day.cq.widget.impl.HtmlLibraryManagerImpl has a debug configuration to determine if the requests are ACTUALLY concatenated. This is documented at http://dev.day.com/docs/en/cq/current/deploying/configuring_osgi.html#par_variable_18

To define multiple dependencies (assuming you are using maven to build from your filesystem and install into CQ5), the clientlibs folder will have a file ".content.xml" that needs the following attribute:

dependencies="[depB,depC]" 
like image 119
IT Gumby Avatar answered Sep 25 '22 05:09

IT Gumby