js模板引擎
模板引擎是为了使用户界面与业务数据(内容)分离而产生的,它可以生成特定格式的文档,用于网站的模板引擎就会生成一个标准的HTML文档。
js模板引擎包括如下:
template
官方参考:
http://aui.github.io/artTemplate
BaiduTemplate
官方参考:
http://baidufe.github.io/BaiduTemplate
juicer
官方参考:
http://juicer.name
doT
官方参考:
http://olado.github.io/doT
kissy
官方参考:
http://docs.kissyui.com和
https://github.com/kissyteam/kissy
mustache
官方参考:
https://github.com/janl/mustache.js
==============================================================
如何选择Javascript模板引擎
- 模板需要在客户端使用还是服务器端?
- 逻辑复杂程度有多少?
- 是不是有运行速度要求?
- 是不是需要预定义的模板?
- 需要Partials支持吗?
- 需要DOM结构或者String字符串类型?
- 除了模板标签,是不是在渲染前后开发语言一致?