TypeError: Handlebars.registerHelper is not a function

后端 未结 3 712
自闭症患者
自闭症患者 2021-02-02 03:59

I am brand new to node and handlebars as of two days ago so bear with me. I am trying to use custom handlebars helpers but am not entirely sure where to put it.

I keep g

3条回答
  •  星月不相逢
    2021-02-02 04:55

    It looks like you need to use it like this, according to the docs found here: https://github.com/ericf/express-handlebars

    var hbs = Handlebars.create({
      // Specify helpers which are only registered on this instance.
      helpers: {
        foo: function () { return 'FOO!'; },
        bar: function () { return 'BAR!'; }
      }
    });
    

提交回复
热议问题