queckezz/koa-views

How to use .njk suffix for file name using nunjacks engine?

silent-tan opened this issue · 2 comments

// views
app.use(views(path.join(__dirname, '../views'), {
  extension: 'nunjucks'
}));

my view file is xxx.njk

but make error: ... can not found xxx.nunjucks

app.use(views(path.join(__dirname, '../views'), {
  map: { njk: 'nunjucks' },
  extension: 'njk'
}));

whereas extension is optional. This is so you can just do this.render('./view') instead of this.render('./view.njk')

Let me know if this helps 🥇

thanks