Skip to content

Extra layer for templating engine: populate and attach easily your templates (specially with api calls)

License

Notifications You must be signed in to change notification settings

boertel/Barbe.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Barbe.js

Extra Layer for your favorite templating engine.

More details here: http://boertel.github.com/Barbe.js/

The main features are:

Get all your templates in one collection

same as ICanHaz.js - https://github.com/HenrikJoreteg/ICanHaz.js

Define in the template where to attach it in the document

<script id="template-name" type="text/html" data-anchor="anchor-name">...</script>

Execute functions on the data before it populates the template

success: function (response) {
    ...
    [return response;]
}

Insert automatically a loader during an ajax call

<div class="barbe-loader"></div>

More Options

Different templating engines

var engine = {};

engine.mustache = {
    render: Mustache.to_html,
    compile: undefined,
    type: ['text/html']
};

engine.hogan = {
    render: function (self, context, partials) {
        return self.render(context, partials);
    },
    compile: function (str) {
        return Hogan.compile(str);
    },
    type: ['text/html']
};

engine.handlebars = {
    render: function (self, context, partials) {
        return self(context);
    },
    //compile: Handlebars.compile,
    compile: function (str, name) {
        Handlebars.registerPartial(name, str);
        return Handlebars.compile(str);
    },
    type: ['text/html']
};

About

Extra layer for templating engine: populate and attach easily your templates (specially with api calls)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published