Node / Express Handlebars - Where to define custom helpers
问题 I'm working on a node / express / handlebars app and I just found out about custom helpers, but I have no idea where to define them. I tried adding some in the actual view template hbs file in a <script> tag like so: <script type="text/javascript"> Handlebars.registerHelper('if', function(conditional, options) { console.log("IN HANDLEBARS HELPER"); if (conditional) { return options.fn(this); } else { return options.inverse(this); } }); </script> But I get a Uncaught ReferenceError: Handlebars