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

后端 未结 7 900
暖寄归人
暖寄归人 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条回答
  •  梦毁少年i
    2020-12-25 09:15

    FYI,

    If you're using Sails 0.10 or above, I have published an NPM package to generate default handlebars views at https://www.npmjs.org/package/sails-generate-views-handlebars

    There is also a proposed PR for sails-generate-backend in order to properly support layouts and partials for handlebar when using ‘sails generate –template==handlebars’ with no additional code and automatic discovery of partials based on a path (aka. views/partial/**)

    See: https://github.com/balderdashy/sails-generate-backend/pull/9

提交回复
热议问题