how to add data-cfsync=”false” attribute in sightly to ignore js in Rocketloader ? | Community
Skip to main content
February 22, 2023
Solved

how to add data-cfsync=”false” attribute in sightly to ignore js in Rocketloader ?

  • February 22, 2023
  • 2 replies
  • 1995 views

 We have implemented Rocketloader functionality on our website and we want the Rocket Loader to ignore one of the clientlibs.

https://developers.cloudflare.com/fundamentals/speed/rocket-loader/ignore-javascripts/

As mentioned in above URL, we are supposed to add data-cfasync=”false” for Rocket Loader to ignore the js, but we are not able to do so with sightly.

 

This is our inclusion tag

<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html"></sly>

<sly data-sly-test="${X}" data-sly-call="${clientlib.js @ categories=X}"></sly>

 

We tried something like this,

<sly data-sly-test="${X}" data-sly-call="${clientlib.js @ categories=X,data-cfasync=”false”}"></sly>

It did not work and gave the following exception.

Any help is appreciated. Thanks in advance.

@tushaarsr @arunpatidar @kautuk_sahni 

 

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 Ravi_Pampana

Hi,

 

We have to write custom logic to include additional tags to AEM clientlibs. You can refer below link for the same

 

https://github.com/arunpatidar02/aem63app-repo/blob/master/java/ClientLibsModel.java

2 replies

Ravi_Pampana
Community Advisor
Ravi_PampanaCommunity AdvisorAccepted solution
Community Advisor
February 22, 2023

Hi,

 

We have to write custom logic to include additional tags to AEM clientlibs. You can refer below link for the same

 

https://github.com/arunpatidar02/aem63app-repo/blob/master/java/ClientLibsModel.java

SAnjana_SAuthor
February 22, 2023

Thanks for your response !

arunpatidar
Community Advisor
Community Advisor
February 22, 2023

you have a sytax error

 

<sly data-sly-test="${X}" data-sly-call="${clientlib.js @ categories=X,data-cfasync=”false”}"></sly>

 

Should be 

<sly data-sly-test="${X}" data-sly-call="${clientlib.js @ categories=X,data-cfasync='false'}"></sly>

 

If this does not work, try with custom clientlibs model 

https://github.com/arunpatidar02/aem63app-repo/blob/master/java/ClientLibsModel.java 

Arun Patidar
SAnjana_SAuthor
February 22, 2023

Hi @arunpatidar ,

<sly data-sly-test="${X}" data-sly-call="${clientlib.js @ categories=X,data-cfasync='false'}"></sly> is not working.

Seems like I need to try with custom clientlibs model.

 

Thanks for your timely response.