Package Exports
- koa-views
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (koa-views) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
koa-views
Template rendering middleware for koa, supporting many template engines.
Installation
$ npm install koa-viewsExample
// Must be used before any router is used
app.use(views('views', {
map: {
html: underscore
}
}));
app.use(function* (next) {
this.locals = {
session: this.session,
title: 'app'
};
yield this.render('user', {
user: 'John'
});
});For more examples take a look at the tests
API
views([path, opts])
path (__dirname): __dirname + where your views are locatedopts: these options go straight to co-views.
Debug
Set the DEBUG environment variable to koa-views when starting your server.
$ DEBUG=koa-views