webpack loader for atpl.
$ npm install atpl-loader -g模板文件后缀为atpl,如index.atpl
- 变量输出以及逻辑语句
//左分割符为<%, 右分隔符为%>,暂不支持自定义Iam<%=name%>//模板内支持JS逻辑,**不要在逻辑中声明out变量,内部使用**<%if(name){%>Iam<%=name%><%}else{%>Helloworld!<%}%>- 模板引用
目前版本尚未解决循环引用的问题,如a引用b,b又引用了a,实际使用中需注意
//引用其他的模板文件Iam<%include('./test/a.tpl')%>,andilikeplaying<%=man.game%>.// 引入模板vartpl=require('./index.atpl');// 数据源vardata={
...
};document.getElementById('#wrapper').innerHTML=tpl(data);Copyright (c) 2015 chencheng. Licensed under the MIT license.