Skip to content

Commit

Permalink
Update README and example for new API
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilm committed Dec 26, 2013
1 parent 2b270af commit 5547bd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions example/app.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 5547bd8

Please sign in to comment.