PureJSTemplate

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-12 19:43:05

软件介绍

Works in IE, Firefox and Webkit browsers.
Most templating languages suck

Ok, if your like me then you hate all templating langauges- they suck, they really suck. I hate them because I hate the rules they enforce upon me, they are slow, and they slow me down. Because of this, usually I end up making code that looks like this:

UGLY:

function display(data) {
var output = "<div>" + data.text + "</div>";
element.innerHTML=output;

}

How horrible is that? That's probably worse than using a bad templating langauge.

Well, after disappointments with other jQuery templating plugins, I decided to make my own:

The Solution: PureJSTemplate

With PureJSTemplate you use old fashioned javascript in your template. You simply surround the javascript in special tags. Here's an example of what you can do:


<#for(var i=0; i<10; i++) { #>
<#=i#>
<#}#>
That will output the numbers 0 through 9. Easy, isn't it?

Using it:

You simply surround your template code with a textarea tag:

and call it from javascript like so:

$("#output").pureJSTemplate(
{
id:"tpl",
data:{}
});

That's it.

Get The Code

Visit a demo/benchmark page here. Get the js here.

本文地址:https://codercto.com/soft/d/23243.html

联盟

联盟

里德•霍夫曼、本•卡斯诺查、克里斯•叶 / 路蒙佳 / 中信出版社 / 2015-2-5 / 39.00元

在充满变化的世界,联盟潜在的合伙人 将不确定的行业转变为可掌控的职业生涯 与世界紧密连接,开创精彩的事业与未来 终生效忠于一家公司已经成为历史,我们正在经历的自由雇佣制——将员工看作自由人——无法建立创新所需的高度信任与合作的关系。 互联网时代,企业如何用全新的人才策略定义员工的忠诚?未来职业成功的秘诀是什么? 《联盟》提供了一种使雇主与员工之间从商业交易转变为互惠关......一起来看看 《联盟》 这本书的介绍吧!

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

html转js在线工具
html转js在线工具

html转js在线工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具