koa@2
is supported by default and koa@1
is not supported
- don't compile released code to ES5 (this means you need Node_v7.6, the same as
koa@2
requires)
- [BugFix] fix error if filename contains dot
- [BugFix] default extension should not be changed
- [BugFix] fix partials not working properly in handlebars
- make consolidate engine source optional and allow configuration
koa@2
support by @ifraixedes
- [BugFix] state will pass now if no locals are passed
- [Bugfix] Select correct extension in order to decide if the view should be sent or rendered
- no root option -> use
views(path, ...)
path
should now always be absolute (no magic anymore)
// don't
app.use(views('./views'))
// do
app.use(views(__dirname + '/views'))
opts
is now always an object, no string can be passed in as engine
// this
app.use(views(__dirname + '/views', 'jade'))
// is now this
app.use(views(__dirname + '/views', {
extension: 'jade'
}))
opts.default
renamed to opts.extension
to avoid misconceptions
// all valid (when opts.extension) set
./fixtures/index.ejs
./fixtures/index.ejs
./fixtures/index
./fixtures/
./fixtures
fixtures
- Breaking:
this.locals
is now this.state
- return and yield next if this.render already exists
- support default to ./index.[ext]
- Resolves circular dependencies in
this.locals
- default extension to .html
- better debug messages
- move default ext to options
- name middleware
- change locals behavior so they don't get set twice
- fix path confusion, hopefully.
- use middleware instead of direct app reference
this.body = yield this.render()
-> yield this.render()
- Use a koa instance to extend koa itself instead of adding a each method on every request.
this.locals =
instead of this.locals()
- Renamed project from
koa-render
to koa-views
.
- added
this.locals()
for per-request locals.
- refactored API
- more descriptive debug messages.
- Allowing using extension different than engine's shortname.