Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lovetingyuan/simple_template

简单的模板编译
https://github.com/lovetingyuan/simple_template

compiler html javascript template

Last synced: about 1 month ago
JSON representation

简单的模板编译

Awesome Lists containing this project

README

        

# simple_template
简单的模板编译

example: [jsfiddle: todo_list](https://jsfiddle.net/tingyuan/ffgmn1hy/)

支持:
* 双花括号表达式绑定 {{ expression }}
* 条件编译 {{ if(expression) content }}
* 列表循环 {{ for(expression) content }}
* 模板变量 {{ var(expression) content }}
* 局部作用域 {{ with(expression) content }}
* 忽略编译输出 {{ ! content }}
* 事件绑定 {{ <div onclick="{{@handler}}"></div> }}
* 自定义方法 {{ foo(arg1, arg2, ...) }}

todo:
* 安全问题(未对模板做安全过滤和转义)
* 性能问题(模板全量更新)