Templates as data

npm install fact
1 downloads in the last week
5 downloads in the last month


HTML Templates as data.

With Fact, you write your templates in an s-expression like abstract syntax tree which gets ran through a list evaluator that has support for macro evaluation.

Example template and usage:

var fact = require("fact");

var templateData = ["html",
    ["title", "Fact - Templates as data"],
    [":js",   "http://localhost/scripts/main.js"],
    [":css",  "http://localhost/style/main.css"]
    ["div", {id: "header", class: "nav"},
    ["div", {id: "canvas"},
        [":each", "@list",
          [":if", [":odd", "@key"],
            ["li", {class: "odd"}, "@val"],
            ["li", {class: "even"}, "@val"]

var template = evalTemplate(data);

    headers: "header data",
    canvas: "canvas data",
    list: [
npm loves you