Handlebars

Previous Next

USoft Web Designer uses handlebars to create HTML within its class factories. Documentation on Handlebars can be found on http://handlebarsjs.com.

A GUI element normally consists of three parts:

HTML

CSS

JavaScript

The HTML of a GUI element is described in a factory using a technology called handlebars. A compiled handlebar definition is stored in the template member of a factory object and is a function that, when called, returns a string that can be converted into HTML:

<div {{attr "*"}} />

 

It is possible to add extra functionality to the handlebar library. This is done by registering new 'helpers':

Handlebars.registerHelper('<name>', function(items, options) {…});

 

USoft by default delivers the helpers listed in the table below.

 

Helper

attr

data

lang

now

preview

rule

 

See Also

Escaping handlebars