In CQ's cq:IncludeClientLib, what's the difference between theme and categories attributes?

StackOverflow https://stackoverflow.com/questions/21842203

  •  13-10-2022
  •  | 
  •  

Question

According to the docs:

categories

A list of comma-separated client lib categories. This will include all Javascript and CSS libraries for the given categories. The theme name is extracted from the request. Equivalent to: com.day.cq.widget.HtmlLibraryManager#writeIncludes

theme

A list of comma-separated client lib categories. This will include all theme related libraries (both CSS and JS) for the given categories. The theme name is extracted from the request. Equivalent to: com.day.cq.widget.HtmlLibraryManager#writeThemeInclude

I am new to CQ and this looks a bit vague to me. What's the difference between these attributes?

Was it helpful?

Solution

Suppose you had the following in the JCR: - /etc/clientlibs/grid - /etc/clientlibs/forms - /etc/clientlibs/tables - /etc/clientlibs/tables/responsive - /etc/clientlibs/tables/inverse

categories should pull in a list of un-related Client Libraries. For instance <cq:includeClientLib categories="grid, forms, tables" />

themes should pull in distinct related Client Libraries. Or probably better described as sub-categories. For instance, <cq:includeClientLib categories="tables" themes="inverse, responsive" />

The difference is themes resides inside of a category. tables could contain but "sub-categories" (or themes), but you have a good reason for breaking them out. You want to use your general tables category on ALL your pages & designs, but certain pages would want an inverse display of the tables. Or only certain pages contain responsive tables.

I thought CQ5.5 had better examples in the code, but CQ5.6 doesn't appear to have much OOB anymore.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top