overland-nunjucks

Nunjucks view engine for Overland.


License
MIT
Install
npm install overland-nunjucks@0.3.0

Documentation

Overland Nunjucks

Nunjucks view engine for Overland.

import { App } from 'overland/core';
import nunjucks from 'overland-nunjucks';

export default class MyApp extends App {
  public static engine = nunjucks;
}

Then in a controller...

class MyCtrl extends Controller {
  async show(ctx) {
    // Rendered template defaults to 'myCtrl/show.html'
    ctx.body = await ctx.render({ foo: 'bar' });
  }
  async index(ctx) {
    // Specify template as optional first argument
    ctx.body = await ctx.render('template.html', { foo: 'bar' });
  }
}