Are there any disadvantages of including a clientlib through its path using <link rel="stylesheet"> and <script src=""> tags rather than its category name using the cq:includeClientLib tag?
For eg. if the client lib path is /etc/designs/myapp/clientlibs
will there be any problem if we include the css as <link rel="stylesheet" href="https://forums.adobe.com/etc/designs/myapp/clientlibs.css" type="text/css"> and js as <script src="/etc/designs/myapp/clientlibs.js"> tags instead of the cq:includeClientlib tag?
The reason, we want to do it this way is, we would like to add few selectors (like /etc/designs/myapp/clientlibs.min.xyz123.css ) for minification and versioning of the CSS and JS libraries.
(Please note that enabling minification through HTML library manager is not an option for us for a different reason. Similarly, we cannot use the ACS commons clientlibs versioning for a reason.)
Solved! Go to Solution.
It would be interesting to know about your reasons, why you cannot use the library manager. In my current project we build the CSS and Javascript externally using a dedicated frontend-build toolchain and embed the resulting files into a clientlib. I don't see a reason why one would not use the clientlibrary mechanism.
Jörg
Views
Replies
Total Likes
The way you mention works and from a technical viewpoint - no disadvantage that i can think of.
Views
Replies
Total Likes
As scott mentioned There is no disadvantage , it just that client libraries gives more flexibility . Its just a more organized way to handle your client side code. Its perfectly okay not to use those.
It would be interesting to know about your reasons, why you cannot use the library manager. In my current project we build the CSS and Javascript externally using a dedicated frontend-build toolchain and embed the resulting files into a clientlib. I don't see a reason why one would not use the clientlibrary mechanism.
Jörg
Views
Replies
Total Likes
We are having a multi-tenant environment. Only some applications want minification to be enabled while others are not ready yet. Enabling minification through the HTML library manager in felix console applies it for all applications in the platform. Couldn't find a way to enable it specific to projects unless we customize the library manager itself. So the approach I mentioned is probably the simplest way to enable minification for some of the applications in the platform.
Views
Replies
Total Likes
Even when all CSS and JS files are getting minified automatically due to your configuration in Library Manager, you still can include the non-minified files in the approach you suggested: something.min.js vs something.js
With clientlibs, we get one CSS and one JS file. If trying to include files by path, you will have to include all the files yourself, increasing the number of requests. The worst place this hits is when Google starts considering your page slow due to more number of requests and rendering of blocking requests above the fold.