I would like to continue adding client library files to JSPs as follows:
<cq:includeClientLib js="some-category" />
But I need to have control over the attributes in the resulting script include. In other words I might want to see
<script type="application/javascript" async defer data-attr="somedata" src="<path to clientlib.min.js></script>
I have not seen any document that explains how to achieve this. I was hoping for something similar to adding classes for cq:htmlTag. Clearly I could do this manually by adding the script tag myself, and manually adding the path to the clientlib, but then I lose the ability to reference by category, which is my major use case for using clientlibs.
Thanks,
Matt
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Matt,
There's no way to change the HTML output by <cq:includeClientLib>. Rather you need to create your own tag which uses the HtmlLibraryManager to get the list of includes for a particular category (or set of categories) and use those to output the appropriate HTML.
What you describe with something like cq:htmlTag seems like a worthwhile enhancement. I'd suggest filing a DayCare issue with the details so that this can be added to the product roadmap.
Regards,
Justin
Views
Replies
Total Likes
Hi Matt,
There's no way to change the HTML output by <cq:includeClientLib>. Rather you need to create your own tag which uses the HtmlLibraryManager to get the list of includes for a particular category (or set of categories) and use those to output the appropriate HTML.
What you describe with something like cq:htmlTag seems like a worthwhile enhancement. I'd suggest filing a DayCare issue with the details so that this can be added to the product roadmap.
Regards,
Justin
Views
Replies
Total Likes
Hi Justin,
Thanks for your help with this, much appreciated. I'll create the tag and use HtmlLibraryManager as you suggest.
I think adding a String[] property to accept various attribute value pairs would be a very helpful addition (or something similar). I'll create a DayCare issue.
Thanks again,
Matt
Views
Replies
Total Likes
Views
Like
Replies