Client libraries for Static Template | Community
Skip to main content
June 8, 2022
Solved

Client libraries for Static Template

  • June 8, 2022
  • 1 reply
  • 762 views

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  ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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'}" />

1 reply

arunpatidar
Community Advisor
Community Advisor
June 8, 2022

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
June 8, 2022

@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 ??

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
June 8, 2022

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