LearnFast.Ninja

Build website with mustache

How to build website with template engine called Mustache.

Mustache available in many languages, for more info go to {{ mustache }} website:

The pain:
1. The need for master page.
2. The need to include parts of html code.
3. How to get rid from this type of coding:

var html = "<div>";
html += "This is an ugly code!";
html += "</div>";


Solution using mustache:
master.html

<!DOCTYPE html>
<html>
<head>
      {{>head}}
</head>
<body>
      <header>
            <a href="/">website name</a>
      </header>
      {{subMenu}}
      <div>
            {{>content}}
      </div>
      {{>footer}}
</body>
</html>


head.html

<title>{{head.title}}</title>
<link rel="shortcut icon" href="favicon.ico" />



Tags

mustache

template master