boo-templates

0.1.4 • Public • Published

👻 boo-templates

a very lightweight (and spoooooky) templating tool (that is also your boo ❤️)

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"

Readme

Keywords

Package Sidebar

Install

npm i boo-templates

Weekly Downloads

0

Version

0.1.4

License

MIT

Last publish

Collaborators

  • brettimus