Expand my Community achievements bar.

SOLVED

Color Picker not working in Template Initial Content (Handlebars.comple is not a function)

Avatar

Level 2

I am using eaem font color picker, that is working fine on page level. But if I try to use it at template level I am facing some issue. In console I see this error :- Uncaught TypeError: Handlebars.compile is not a function

Upon checking further, I see there is a version difference.

On page level Handlebars version is 4.7.3 but in case of Template it is 4.0.14.

I need to know how can I upgrade the Handlebars version getting loaded at template level.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

hi @saurabhkaushik ,

So, there are couple of things that I see :

  • There are 2 different categories : cq.handlebars & handlebars and both are having different versions located on different paths
  • coralui2 has dependency on coralui3 and hence both would be called on any page including the templates as well. (You can check view source and see which all clientlibs are being called.)

I would suggest you to explicitly call cq.handlebars clientlibs(having latest version) in template to avoid the error you are seeing.

 

View solution in original post

3 Replies

Avatar

Employee Advisor

Hi @saurabhkaushik 

Can you please confirm the version of AEM and the Service pack installed(if any ?)

Can you install latest service pack by following the link and then try. 

A similar thread can be seen here which can also be given a shot: 
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/quot-handlebars-compile-is...

 

Thanks.

Avatar

Level 2

Hi @milind_bachani , I am using AEM 6.5 Service Pack 6.

Thanks for the reference link, what I observe is, version 4.0.14 is present in /libs/clientlibs/granite/coralui3/js/all.js and 4.7.3 is present in /libs/clientlibs/granite/coralui2/optional/clientlibs/source/handlebars-v4.7.3.min.js

I have not explicitly include coralui2 or coralui3 categories in my project.

Not sure how AEM is internally picking 4.0.14 (from coralui2 categories) in case of Templates and 4.7.3 (from coralui3 categories) in case of Pages.

Avatar

Correct answer by
Employee Advisor

hi @saurabhkaushik ,

So, there are couple of things that I see :

  • There are 2 different categories : cq.handlebars & handlebars and both are having different versions located on different paths
  • coralui2 has dependency on coralui3 and hence both would be called on any page including the templates as well. (You can check view source and see which all clientlibs are being called.)

I would suggest you to explicitly call cq.handlebars clientlibs(having latest version) in template to avoid the error you are seeing.