Client libraries for Static Template | Community
Skip to main content
Level 4
Jun 8, 2022 9:37 AM UTC
Solved

Client libraries for Static Template

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.
arunpatidar
arunpatidarAccepted solution
New Participant
Jun 8, 2022 12:04 PM UTC

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

3 replies

arunpatidar
New Participant
Jun 8, 2022 10:50 AM UTC

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

 

 

Translate
Arun Patidar
Level 4
Jun 8, 2022 11:50 AM UTC

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

Translate
arunpatidar
arunpatidarAccepted solution
New Participant
Jun 8, 2022 12:04 PM UTC

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

Translate
Arun Patidar