From 5547bd8d3f5f11742ae0f34a891af73dff4b7d42 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Thu, 26 Dec 2013 11:37:04 -0800 Subject: [PATCH] Update README and example for new API --- README.md | 6 ++++-- example/app.js | 12 +++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 76bc60b..47302d1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ koa-hbs Handlebars Templates via Generators for [Koa](https://github.com/koajs/koa/) ## Foreward -This is package offers minimum viability. There is no support for partials or layouts yet. You may render a self contained template. Handlebars helpers can be defined on your own instance of Handlebars which you pass to koa-hbs options. +This is package offers minimum viability. Registering partials and synchronous +helpers is supported, but asynchronous helpers and layouts are not. Layouts are +next on the list. ## Usage koa-hbs is middleware. Configure the default instance by passing an options hash to #middleware, or create an independent instance using #create(). @@ -39,7 +41,7 @@ The plan for koa-hbs is to offer identical functionality as express-hbs (eventau - `extname`: Alter the default template extension (default: `.hbs`) - `partialsPath`: Use this directory for partials -These options are **NOT** supported yet. +These options are **NOT** supported (because we don't support layouts ... yet). - `contentHelperName`: Alter `contentFor` helper name - `blockHelperName`: Alter `block` helper name diff --git a/example/app.js b/example/app.js index 1637121..550f521 100644 --- a/example/app.js +++ b/example/app.js @@ -1,14 +1,12 @@ var koa = require('koa'); -var hbs = require('../index'); // require koa-hbs +var hbs = require('..'); + var app = koa(); -// Options for koa-hbs. See below for full options -var hbsOptions = { +// koa-hbs is middleware. Use it before you want to render a view +app.use(hbs.middleware({ viewPath: __dirname + '/views' -} - -// koa-hbs isn't a middleware - call hbs passing app and options -hbs(app, hbsOptions); +})); // Render is attached to the koa context. Call this.render in your middleware // to attach your rendered html to the response body.