express-handlebars-layouts

1.0.0 • Public • Published

Express-Handlebars-Layouts

Usage

You only need to call scanRoutes and pass the directory that contains your routes

var handlebars  = require('express-handlebars'),
    layouts = require('express-handlebars-layouts');

module.exports = function(app){
    var hbs = handlebars.create({
        partialsDir: [
            'templates/partials/'
        ]
    });

    //Register layouts helpers on handlebars
    hbs.handlebars.registerHelper(layouts(hbs.handlebars));

    app.engine('handlebars', hbs.engine);
    app.set('view engine', 'handlebars');
    app.set('views', global.__basedir + '/templates');

    if( global.config.get('handlebars.cache') ){
        app.enable('view cache');
    }
};

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i express-handlebars-layouts

      Weekly Downloads

      1

      Version

      1.0.0

      License

      MIT

      Last publish

      Collaborators

      • arielfr