JavaScript 的 JSON 模板引擎 Kata
Git@OSC 手机客户端摇一摇,有惊喜有妹纸
Kata 是一个 JavaScript 模板引擎。包括:Template blocks, Interpolate blocks, Iterate blocks, Conditional blocks, Else/Elseif blocks, Invoke blocks, Yield blocks, Import blocks, Evaluate blocks, and Plugin blocks.
示例代码:
var kata = require('kata');var fs = require('fs');fs.readFile('template.kata', {encoding: 'utf8'}, function(err, src){ var template; if (err) return; template = kata(src); console.log(template({greeting: 'Hello', name: 'World'}));});