Giter VIP home page Giter VIP logo

html's Introduction

HTML is The BEST JavaScript templating language EVER

HTML was heavily inspired by Jade from 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 or 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

var 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 Object

var 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.

html's People

Contributors

fb55 avatar marak avatar mmalecki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.