Nostalgic Pickled Mango

    lark-views

    2.0.1 • Public • Published

    lark-views

    This repository began as a GitHub fork of queckezz/koa-views.

    NPM version build status NPM downloads Node.js dependencies

    Template rendering middleware for koa, supporting many template engines.

    Installation

    $ npm install lark-views
    

    Example

    Use lark-views as a Class.

    const Views = require('lark-views');
     
    const views = new Views({
      path: 'views',
      map: {
        tpl: 'ejs',
      }
    });
     
    views.render('a.tpl', { foo: "bar" })
         .then(data => console.log(data))
         .catch(e => console.error(e.stack));

    API

    views([opts])

    • opts: see below
    • opts.map: map from extname to template engine name.
    • opts.path: directory path relative from main module file if it is not an absolute path.
    • opts.engine: template engine, must have a method render(template, data) which returns final result.

    License

    MIT

    Install

    npm i lark-views

    DownloadsWeekly Downloads

    4

    Version

    2.0.1

    License

    MIT

    Last publish

    Collaborators

    • mdemo
    • zezhou
    • viringbells