Template Engine for IOPA fabric for Handlebars, Mustache, Dust, Razor etc.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
src
test
tools
.gitignore
LICENSE
NOTICE
README.md
demo.js
index.js
package.json
shippable.yml

README.md

IOPA
iopa-templates

Build Status IOPA limerun

NPM

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