Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Client libraries for Static Template

Avatar

Level 5

Hello all, 

Is it possible to include client libraries for Static template ?? And can we only give Page(core component) as a resource type for static template  ?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

If you want, you can create more js and css folder(client library) but make sure the category would be same as you used inside headlibs or footlibs , otherwise you need to add one more line in your libs file.

Example

<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientlib.css @ categories='mysite.core.cat1'}" />

<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientlib.css @ categories='mysite.core.cat2'}" />



Arun Patidar

View solution in original post

3 Replies

Avatar

Community Advisor

Hi,

It is possible and have been done in the past as well.

You have to it in headlibs.html or footerlibs.html

 

<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientlib.css @ categories='mysite.core'}" />

 

 



Arun Patidar

Avatar

Level 5

@arunpatidar  Thank you. I have also checked my project structure. There also I can see the like the above clientlib code. So is it enough or do I need to create separate clientlib folder with css & js ??

Avatar

Correct answer by
Community Advisor

If you want, you can create more js and css folder(client library) but make sure the category would be same as you used inside headlibs or footlibs , otherwise you need to add one more line in your libs file.

Example

<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientlib.css @ categories='mysite.core.cat1'}" />

<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientlib.css @ categories='mysite.core.cat2'}" />



Arun Patidar