前端模板引擎

来源:互联网 发布:目前最好的排序算法 编辑:程序博客网 时间:2024/05/21 09:40

 


    1. 原理剖析

其本质是利用正则表达式,替换模板当中预先定义好的标签。
正则表达式exec用法
http://www.w3school.com.cn/jsref/jsref_exec_regexp.asp
    1. 流行模板引擎

BaiduTemplatehttp://tangram.baidu.com/BaiduTemplate/
ArtTemplatehttps://github.com/aui/artTemplate
velocity.jshttps://github.com/shepherdwind/velocity.js/
Handlebarshttp://handlebarsjs.com/
参考资料:
http://blog.jobbole.com/56689/
    1. artTemplate

1、引入template-native.js
2<%  %> 符号包裹起来的语句则为模板的逻辑表达式
3<%= content %>输出表达式

0 0