How to include component level resources, while following the best practices.
Ex:
I am looking at the geometrixx media site in CQ 5.6. In the some of components, ex: 2-col-article-summary we have a client library defined under the component.
/apps/geometrixx-media/components/2-col-article-summary
-2-col-article-summary.jsp
-clientlibs
-css
…..
-css.txt
if i look at the categories of the clientlib, it is defined as follows
categories String[] apps.geometrixx-media, apps.geometrixx-media.2-col-article-summary
The only place this client library is included is in the head.jsp of main page level component.
<cq:includeClientLib categories="apps.geometrixx-media.all"/> - this in turn embeds the apps.geometrixx-media
my questions are as follows
1) Why do we have two categories for the clientlib, if ithe second category name( apps.geometrixx-media.2-col-article-summary) is not being used. Is there is some other usage for this i am missing.
2) Also these set of css is always included no matter whether a specific component is added to the page or not.
3) I could use the following to include the client at the component level, but this will cause unnecessary <script> and <link> elements at the component level mark up.
<cq:includeClientLib categories="apps.geometrixx-media.2-col-article-summary"/>
Essentially i am trying to understand, how to include a specific component level resources while following the best practices