An open API service indexing awesome lists of open source software.

https://github.com/marak/html

HTML is The BEST JavaScript templating language EVER
https://github.com/marak/html

Last synced: over 1 year ago
JSON representation

HTML is The BEST JavaScript templating language EVER

Awesome Lists containing this project

README

          

# HTML is The BEST JavaScript templating language EVER

**HTML was heavily inspired by [Jade](http://github.com/visionmedia/jade) from [Visionmedia](http://github.com/visionmedia/)**

## Features

- HTML is valid (X) HTML 4.01 and HTML5!
- HTML is Insanely Fast !
- Safari, Internet Explorer, Chrome, and Firefox are all specifically optimized for rendering HTML!
- HTML is highly portable ( Even tested it in Microsoft Frontpage and Macromedia Dreamweaver )
- HTML is `< 4 bytes` in size!
- It's not possible to write logic in HTML
- I'm pretty annoyed I had to build this.

*Note: I have no fucking clue how to successfully use [Weld](https://github.com/hij1nx/weld) or [Plates](https://github.com/flatiron/plates).*

## Core Concepts

- You already know HTML
- JSON data automatically maps to CSS classes
- You cannot define any custom logic or maps with HTML
- That's it.

## Examples

### Rendering basic data

```js
var html = require('html-lang');
console.log(html.render({ name: "Bob" }, tmpl));
```

```html

name placeholder


```

**outputs:**

```html

Bob


```

### Rendering an Object

```js
var html = require('html-lang');

var user = { user: { name: "Bob", email: "bob@bob.com" }};

console.log(html.render(user, tmpl));
```

```html


name placeholder




```

**outputs:**

```html


Bob




```

### Rendering an Array of Objects ( collection )

```js
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));
```

```html



name placeholder





```

**outputs:**

```html



Bob


bob@bob.com




Marak


marak@marak.com




```

### XML Node Attributes

```html


```

```js
var html = require('html-lang');

var data = {
'link': "The big website",
'link.href': "http://big.vc"
};

console.log(html.render(data, tmpl));
```
**outputs:**

```html

The big website


```

# That's it. I challenge you to find a use-case that isn't covered by HTML.