render-then

1.0.0 • Public • Published

NPM version Build status Test coverage License Dependency status

Promise based template rendering using consolidate.js.

Options

  • map an object mapping extension names to engine names [{}]
  • default default extension name to use when missing [html]
  • cache cached compiled functions [NODE_ENV !== 'development']

Example

let render = require('render-then');
let renderer = render('views', {
  map: {
    html: 'swig'
  }
});

renderer('user', {
  user: {
    name: 'haoxin'
  }
}).then(function(res) {
  console.log(res);
}).catch(function(err) {
  console.error(err);
});

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i render-then

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • coderhaoxin