代码拉取完成,页面将自动刷新
Lightweight javascript template engine. Adaptation AMD, CMD and global environment
tpl.js
: <script type="text/javascript" src="path/to/tpl.js"></script>
Or in sea.js, you can include by: var tpl = require('path/to/tpl');
<script type="text/template" id="demo"></script>
Or use internal method echo()
:
<script type="text/template" id="demo"></script>
console.log( tpl('#demo', {author: "Jony", languages: ["javascript", "php", "shell"]}) );
<p>Hi, I'm Jony</p>
<p>I can write: javascript, php, shell</p>
<# include("#tpl_id") #>
tpl(template, data)
tpl(template)(data)
tpl(template)
template
can be a html template string or '#' plus an id, This will return a rendered html string.
tpl.js use UglifyJS2
you should have installed nodejs and run npm install uglify-js -g
.
On Windows, you can run build.bat
from root directory and it will package tpl.debug.js
into tpl.js
.
tpl.js is available under the terms of the MIT License.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。