A simple template for wxapp, mimicing lodash.template
api. It supports following syntax:
-
<%= variable %>
print out raw variable -
<%- variable %>
html escape variable -
<% if (variable) { %> XXX <% } %>
evaluate condition based on variable
$ npm install liuz-wxapp-template
const template = require('liuz-wxapp-template');
var tpl = 'Hello <%= username %>!';
var data = {
username: 'Spiderman',
}
console.log(template(tpl)(data));