How to configure partials and layouts for Handlebars in Sails.js?

后端 未结 7 881
暖寄归人
暖寄归人 2020-12-25 08:27

I run Sails 0.9.7 and have installed Handlebars which is supported by Consolidate.js and therefore is supported by Sails

I can serve pages from .handlebars

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-25 09:16

    I'm running out of time but I'm getting close to an answer, I think. I'll update this reply when I get more details, but if you want to poke at it, check out line 501 in the included consolidate.js file. View on github here: https://github.com/balderdashy/sails/blob/master/lib/configuration/consolidate.js#L501

    It looks like for Handlebars there is a for loop that registers partials from options.partials.

    That is not exactly a very satisfying solution, but if you push your partials on to that options object then maybe it will pull from that.

    The big question I have next is, what is the options object, and where does it get set at?

提交回复
热议问题