Archive. Date of access: 12 Jan 2022
Marak 6d3a7d9660 Merge pull request #12 from matteofigus/master | 11 éve | |
---|---|---|
examples | 11 éve | |
lib | 11 éve | |
tests | 11 éve | |
README.md | 11 éve | |
package.json | 11 éve |
HTML was heavily inspired by Jade from Visionmedia
< 4 bytes
in size!Note: I have no fucking clue how to successfully use Weld or Plates.
var html = require('html-lang');
console.log(html.render({ name: "Bob" }, tmpl));
<p class="name">name placeholder</p>
outputs:
<p class="name">Bob</p>
var html = require('html-lang');
var user = { user: { name: "Bob", email: "bob@bob.com" }};
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">bob@bob.com</p>
</div>
var html = require('html-lang');
var users = [
{ name: "Bob", email: "bob@bob.com"},
{ name: "Marak", email: "marak@marak.com"}
];
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>bob@bob.com</p>
</div>
<div class="user">
<p>Marak</p>
<p>marak@marak.com</p>
</div>
</div>
<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>