![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Tp 是一个 “轻量,简洁,高效” 的 javascript 模板引擎!
+ 轻量,tp是目前能见到最轻量的javascript模板引擎,只有一个不足1.5k的文件。
+ 简洁,tp的语法非常简单,对于一个熟悉html、js的开发人员来说学习难度为 0。
+ 高效,tp支持模板预编译,快于任何一个你所见过的javascript模板引擎。
+ 另外,tp同时支持在浏览器环境使用及服务端javascript环境(Node.js)使用。
+ 您可以发邮件到 admin@xhou.net
+ 或者访问 http://www.houfeng.net
+ 关注微博 http://weibo.com/houfeng
+ 下载tp
+ 将tp.js或tp-min.js放到项目中合适的位置。
+ 在相关页面用<script src='tp的url'></script>引入tp。
var tp = require('相对路径');
代码:
var html='<div>My name is <% $(name) %></div>';
var rs=tp.parse(html,{name:'tp'});
结果:
rs: “<div>My name is tp</div>”
代码:
var html='<div>My name is <% $(name) %></div>';
var fn=tp.compile(html);
var rs=fn({name:'tp'});
结果:
fn: 编译结果,可以暂存以供调用。
rs: “<div>My name is tp</div>”
HTML:
<script id="list-template" type='text/template'>
<% for(var i in this %>
<li><% $(this[i]) %></li>
<% } %>
</script>
<ul id="list">
</ul>
代码:
//绑定数据:
tp.bind({
template:'list-template',
element:'list',
model:["item-1","item-2"]
});
//追加绑定数据:
tp.bind({
template:'list-template',
element:'list',
model:["item-1","item-2"],
append:true
});
结果:
<ul id="list">
<li>item-1</li>
<li>item-2</li>
</ul>
[sudo] npm install tpjs [-g]
var tp = require('tpjs');
//解析
var rs = tp.parse(html,options);
//预编译
var fn = tp.compile(html,options);
使用命令行工具需要全局安装 tpjs,如下
[sudo] npm install tpjs -g
CLI 说明
tp <src> <dst>
FAQs
最简洁高效的js模板引擎!
The npm package tpjs receives a total of 14 weekly downloads. As such, tpjs popularity was classified as not popular.
We found that tpjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.