How/Where to use Custom Handlbars Helpers in Stenc

2019-09-10 18:44发布

问题:

I'm familiar with how to code a custom Handlebars Helper, but where do I put the helper code within the files?

I've tried including my own JS file in the head and after the body, but I get the following error in the JS console:

Uncaught ReferenceError: Handlebars is not defined

Am I doing something wrong or is this a 'feature' of the Stencil implementation of Handlebars?

All help greatly appreciated!

回答1:

All the helpers are predefined that can be used with Stencil "natively". If you'd like to register your own, you'd need to include handlebars as apart of your theme and create them clientside.