node-xtemplate
A node.js wrapper around xtemplate engine
Last updated 3 years ago by zce .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install node-xtemplate 
SYNC missed versions from official npm registry.

Node xTemplate

NPM version NPM download Build Status Dependency Status devDependency Status Code Style

A node.js wrapper around xtemplate engine

Install

$ npm install --save node-xtemplate

Usage

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
  })

API

render(path, data[, options], callback)

path

Type: string

The path of template file.

data

Type: object

The template data.

options

extname

Type: string

strict

Type: boolean

catchError

Type: boolean

cache

Type: boolean

encoding

Type: string
Default: utf-8

callback(err, result)

Type: function

Done callback

License

MIT © 汪磊

Current Tags

  • 0.1.6                                ...           latest (3 years ago)

7 Versions

  • 0.1.6                                ...           3 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 0
This Week 21
This Month 53
Last Day 0
Last Week 10
Last Month 20
Dependencies (4)
Dev Dependencies (1)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |