boo-templates
v0.1.4
Published
a small template library (and your boo)
Downloads
3
Readme
:ghost: boo-templates
a very lightweight (and spoooooky) templating tool (that is also your boo :heart:)
a Template
var template = new BooTemplate("This is {{foo}}ey.");
template.compile({foo: "barn"});
// => "This is barney."
var template = new BooTemplate("This is <%foo%>ey.", "<%", "%>");
template.compile({foo: "barkl"});
// => "This is barkley."
a Compiler(open, close)
the Compiler is what powers a template. It implements a global search on a given template string and evalutes anything between open
and close
delimiters.
open
and close
default to "{{"
and "}}"
var compiler = new BooTemplate.Compiler();
compiler.compile("{{foo}}{{bar}}", {foo: "Boo", bar: "Template"});
// => "BooTemplate"
var compiler = new BooTemplate.Compiler("<%", "%>");
compiler.compile("<%foo%> <%bar%>", {foo: "Your", bar: "Boo"});
// => "Your Boo"