Node.js + Express - How to get Mustache partials working?

前端 未结 3 1992
小鲜肉
小鲜肉 2021-01-18 15:35

I\'m trying to get Mustache working properly with Express, and as one can guess, I\'m having troubles.

The following line initializes Mustache nice and clean. Variab

3条回答
  •  梦毁少年i
    2021-01-18 15:53

    I'm not sure what's exactly in your ./public/js/libs/mustache.js ... I use the mustache module from npm + a variation of the templating object you linked to.

    In any case, the object you pass to app.register needs to call mustache.to_html(template, locals, partials) at some point.

    You need to pass the partials object as the third argument to mustache's to_html.

提交回复
热议问题