iopa-templates

0.9.1 • Public • Published

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

Package Sidebar

Install

npm i iopa-templates

Homepage

iopa.io

Weekly Downloads

7

Version

0.9.1

License

Apache-2.0

Last publish

Collaborators

  • tinialabs1
  • iopa-admin
  • guycreate