在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Marak/HTML开源软件地址:https://github.com/Marak/HTML开源编程语言:JavaScript 100.0%开源软件介绍:HTML is The BEST JavaScript templating language EVERHTML was heavily inspired by Jade from Visionmedia Features
Note: I have no fucking clue how to successfully use Weld or Plates. Core Concepts
ExamplesRendering basic datavar html = require('html-lang');
console.log(html.render({ name: "Bob" }, tmpl)); <p class="name">name placeholder</p> outputs: <p class="name">Bob</p> Rendering an Objectvar html = require('html-lang');
var user = { user: { name: "Bob", email: "[email protected]" }};
console.log(html.render(user, tmpl)); <div class="user">
<p class="name">name placeholder</p>
<p class="email">email placeholder</p>
</div> outputs: <div class="user">
<p class="name">Bob</p>
<p class="email">[email protected]</p>
</div> Rendering an Array of Objects ( collection )var html = require('html-lang');
var users = [
{ name: "Bob", email: "[email protected]"},
{ name: "Marak", email: "[email protected]"}
];
console.log(html.render(users, tmpl)); <div class="users">
<div class="user">
<p class="name">name placeholder</p>
<p class="email">email placeholder</p>
</div>
</div> outputs: <div class="users">
<div class="user">
<p>Bob</p>
<p>[email protected]</p>
</div>
<div class="user">
<p>Marak</p>
<p>[email protected]</p>
</div>
</div> XML Node Attributes<p class="name"><a href="" class="link"></a></p> var html = require('html-lang');
var data = {
'link': "The big website",
'link.href': "http://big.vc"
};
console.log(html.render(data, tmpl)); outputs: <p class="name"><a href="http://big.vc" class="link">The big website</a></p> That's it. I challenge you to find a use-case that isn't covered by HTML. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论