npm安装
npm install art-template --save
在浏览器中实时编译,可以使用lib/template-web.js
因为浏览器并不支持文件系统,因此template(filename,data)
不支持传入文件路径,内部使用document.getElementById(filename).innerHTML
获取模板
<script src="lib/template-web.js"></script>
<script id="tpl-user" type="text/html">
{{if user}}
<h2>{{user.name}}</h2>
{{/if}}
</script>
在浏览器中预编译,可以使用Webpack的art-template-loader
常用的插件包括:
webpack:art-template-loader
Express:express-art-template
Koa:koa-art-template
【参考】
1。art-template官网:https://aui.github.io/art-template/zh-cn/docs/installation.html