This package has been deprecated

Author message:

this package has been deprecated

tie-handlebars

0.2.0 • Public • Published

Tie-Handlebars

Handlebars' templates depending on tie's constraints.

Usage

// Handlebar (compiled) template.
var source = tie("<p>Hello, my name is {{name}}. I am from {{hometown}}. I have " +
     "{{kids.length}} kids:</p>" +
     "<ul>{{#kids}}<li>{{name}} is {{age}}</li>{{/kids}}</ul>");
var template = tie(function(){
    return handlebars.compile(source.get());
});
// Template's argument.
var data = tie({
    "name": "Alan",
    "hometown": "Somewhere, TX",
    "kids": [
        {"name": "Jimmy", "age": "12"},
        {"name": "Sally", "age": "4"}
    ]
});
// Constraint on the result of the application of data on the template template.
var result = tieHandlebars(template, data);

Note

  • The template nor the data does not have to be constraints. One may directly provide their value to tieHandlebars.
  • Non compiled template are not supported. Ideally, you should precompile your templates.

Package Sidebar

Install

npm i tie-handlebars

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • quentinroy