iopa-templates
v0.9.1
Published
Template Engine for the IOPA Stack for Node.js
Downloads
30
Readme
iopa-templates
About
iopa-templates
is IOPA middleware for rendering templates using template engine such as handlebars, moustache, dust, razor, etc
Installation
$ npm install iopa-templates
Goals and Features
Ability to support layouts
Ability to support partials
Ability to support precompiled templates for use on the client
Ability to use a different template engines
Installation
Install using npm:
$ npm install iopa-templates
Basic Usage
const iopa = require('iopa'),
templates = require('iopa-templates'),
handlebars = require('iopa-handlebars'),
razor = require('iopa-razor')
var app = new iopa.App();
app.use(templates);
app.engine('.hbs', handlebars.engine({defaultLayout: 'main', views: 'test/views', partials: 'test/views/partials'}));
app.engine('.js.html', razor.engine({defaultLayout: 'index', views: 'test/views'}));
app.use(function(context, next) {
return context.render('home.hbs', {modelkey: "value"} );
});
http.createServer(app.buildHttp()).listen(3000);
License
Apache 2