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
Sails supports handlebars and its (multiple-layout, partials) natively, if we use .handlebars extensions for our files instead of .hbs.
So to use handlebars in Sails instead of EJS, it advised to use consolidate(Its a template engine consolation library). Handlebars works good with SailsJs + consolidate.
You need to install consolidate.
npm install consolidate --save
And then you just have to update the config/views.js file with the following content.
module.exports.views = {
engine: {
ext: 'handlebars',
fn: require("consolidate").handlebars
},
layout: 'layouts/layout',
partials: 'partials/'
};
Update all your .ebs files to .handlebar files and update the code inside it.
Everything will work fine.
There is a view-generator, for the later purpose which will generate default views for Sails(It will make a default directory structure with default files in it).
You can find it in the github repository.(https://github.com/bhaskarmelkani/sails-generate-views-hbs)
It is similar to the one officially launched by SailsJs for jade called balderdashy/sails-generate-views-jade.