Expand my Community achievements bar.

SOLVED

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

Avatar

Level 1

 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.

SAnjana_S_0-1677045962308.png

Any help is appreciated. Thanks in advance.

@Tushaar_Srivastava1 @arunpatidar @kautuk_sahni 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

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

Avatar

Community Advisor

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

Avatar

Level 1

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.