tempistry.zip
tempistry 是超轻量级的序列化 JavaScript 模板和先后呈现逻辑注册。安装:npm install tempistry使用 temper 来编译,所以支持以下渲染引擎:jadeejshogan.jsmustachehandlebars服务端示例var tempistry = require('tempistry'); var templateString = tempistry.serialize('/my/templates/file.jade'); // you can send this to the browser as a string and call the function var clientJS = "var myTemplate = " templateString;客户端示例var tempistry = require('tempistry'); // register functions w/ the global tempistry lib, receive the template function back var template = tempistry.register(function() { /** function string provided from server-side tempistry.serialize() call*/}); // mixin pre/post render logic tempistry.on('pre-render', function(data) { // override "name" data.name = 'asher'; }); // wire in post-render logic, receiving the data that was rendered and the html string tempistry.on('post-render', function(result) { console.log(result.data.name); // asher console.log(result.html); // html string returned from template fn }); // call the template function var html = template({ name: 'kellan' }); // name will be 'asher' in the html produced 标签:tempistry
- 1
- 粉丝: 510
- 资源: 1万+
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助