Registers a template engine to be used with
view helpers and compression.
Example
$.View.register({
suffix : "tmpl",
renderer: function( id, text ) {
return function(data){
return jQuery.render( text, data );
}
},
script: function( id, text ) {
var tmpl = $.tmpl(text).toString();
return "function(data){return ("+
tmpl+
").call(jQuery, jQuery, data); }";
}
})
Here's what each property does:
suffix - files that use this suffix will be processed by this template engine
renderer - returns a function that will render the template provided by text
script - returns a string form of the processed template function.
$.View.register(info) -> undefined
{Object}
a object of method and properties
that enable template integration:
suffix - the view extension. EX: 'ejs'
script(id, src) - a function that returns a string that when evaluated returns a function that can be
used as the render (i.e. have func.call(data, data, helpers) called on it).
renderer(id, text) - a function that takes the id of the template and the text of the template and
returns a render function.
Registers a template engine to be used with view helpers and compression.
Example
Here's what each property does: