0.0.2 • Published 5 years ago

liuz-wxapp-template v0.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

wxapp-template

A simple template for wxapp, mimicing lodash.template api. It supports following syntax:

  1. <%= variable %> print out raw variable
  2. <%- variable %> html escape variable
  3. <% if (variable) { %> XXX <% } %> evaluate condition based on variable

Install

$ npm install liuz-wxapp-template

Usage

const template = require('liuz-wxapp-template');
var tpl = 'Hello <%= username %>!';
var data = {
    username: 'Spiderman',
}

console.log(template(tpl)(data));