1.1.1 • Published 9 years ago

simple-handlebars v1.1.1

Weekly downloads
9
License
MIT
Repository
github
Last release
9 years ago

simple-handlebars

Build Status

npm install simple-handlebars

simple-handlebars is a Handlebars engine designed for simplicity, made for express. It supports partials, multiple extensions(like .hbs and .handlebars) and view caching for a maximum performance.

How to Use

var app = require('express')();
var hbs = require('simple-handlebars');

app.engine('hbs', hbs({
  partials: __dirname + '/views/partials',
  extension: '.hbs'
}));

app.set('views', __dirname + '/views');

API

hbs(options)

options:

partials - an array or a string. If it is a string, reads it as a directory and

extension - the file extension you're using. Usually .hbs or .handlebars. By default uses .hbs. This property is ignored if you send an array to partials

handlebars - if you need a different Handlebars implementation. By default uses handlebars

caches - By default, simple-handlebars only caches if process.env.NODE_ENV is 'production'.

hbs#registerHelper(name, fnc)

Calls InternalHandlebars.registerHelper(name, fnc).

var app = require('express')();
var hbs = require('simple-handlebars');

var instance = hbs({
  partials: __dirname + '/views/partials',
  extension: '.hbs'
});

instance.registerHelper('helper', function() {
  // your helper here
});

app.engine('hbs', instance);

app.set('views', __dirname + '/views');
1.1.1

9 years ago

1.1.0

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago