A node.js wrapper around xtemplate engine
$ npm install --save node-xtemplate
demo.xtpl
<p>{{ message }}</p>
demo.js
const xTemplate = require('node-xtemplate')
// callback
xTemplate.render(path.resolve(__dirname, 'demo.xtpl'), {
message: 'hello world'
}, function (err, result) {
// result => <p>hello world</p>
})
// or promise
xTemplate
.render(path.resolve(__dirname, 'demo.xtpl'), { message: 'hello world' })
.then(function (result) {
// result => <p>hello world</p>
})
.catch(function (err) {
// if err
})
Type: string
The path of template file.
Type: object
The template data.
Type: string
Type: boolean
Type: boolean
Type: boolean
Type: string
Default: utf-8
Type: function
Done callback