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
- Host: GitHub
- URL: https://github.com/marak/html
- Owner: Marak
- Created: 2012-08-19T11:04:01.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2013-06-03T23:34:52.000Z (about 13 years ago)
- Last Synced: 2024-10-29T11:27:27.368Z (over 1 year ago)
- Language: JavaScript
- Homepage: http://html-lang.com
- Size: 255 KB
- Stars: 101
- Watchers: 17
- Forks: 64
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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
email placeholder
```
**outputs:**
```html
Bob
bob@bob.com
```
### 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
email 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
```
# That's it. I challenge you to find a use-case that isn't covered by HTML.