Can somebody help me with a sample code on how to use the handlebars runtime library (handlebars.runtime.js) please?
I have tried to use Handlebars.compile, which obviously does not work, because I know runtime library is to avoid compiling templates.
Also I have tried to use Handlebars.template method by passing the template as a string, but it is not working as the template method expects a function as a parameter.
I think I am doing something basically wrong. Are there any documentations on how to use runtime library on its own?
Much appreciate the help.
More details: I first used handlebars.js file, which was working good, but my team-mate noticed the compressed file is too big (>40KB) for our purpose (just a few templates in our site).
So, I tried using just handlebars.runtime.js file. Is this correct, or am I missing something?
Here is the sample I have tried: http://jsfiddle.net/2KfsM/
<div id="container"></div>
<script id="hb-example" type="text/handlebars-template">
<p>{{sampleText}}</p>
</script>
The js piece:
var template = Handlebars.compile($('#hb-example').html());
$('#container').html(template({sampleText: 'Here is a sample'}));