Skip to content

Repository files navigation

atpl-loader

NPM versionBuild StatusCoverage StatusNPM downloads

webpack loader for atpl.


Install

$ 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);

LISENCE

Copyright (c) 2015 chencheng. Licensed under the MIT license.

About

Webpack loader for anima-template.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages