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

后端 未结 7 885
暖寄归人
暖寄归人 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:06

    For configuring handlebars template in sails js , follow below steps:

    1) install handlebars in your application's node_modules folder:

    npm install handlebars

    2) change your config/views.js

    engine:   'handlebars',
    layout:   'layouts/layout', // layouts is subfolder of view folder in sails app and layout is a handlebars inside layouts folder.
    partials: 'partials'
    

提交回复
热议问题