This post is by no means a tutorial, just chronocling my short adventure into HTML templates tonight.
I've just started playing around with HTML templates. It took me a small amount of searching for the right tutorials, but after a while I found a couple that when I combined them it all started worked together nicely. `
HandleBars is pretty simple to use. Stare at the
documentation and syntax for a while, then realize that yes, if you want
to do anything 'fancy' like
if(a==b) that you'll need to write your own
helper. But, if you're just looking for some simple and easy to use
templating, it's great.
.load() function turned out to be very useful. Since I could point it
to a url and then simply use a callback function once it was done. After
a few false starts (such as realizing that
if(a==b) was beyond Handlebar's
abilities) I got a template spitting information out onto the page.
From there, I moved the data itself into it's own file that I loaded again,
.load(). Figuring that if I make a backend API to power my small
project I'm starting on, that abstracting the data into it's own areas
accesible via URL now, will turn out to be good foresight later on.
We'll see what else comes of it. Oh, the best thing about HandleBar is that you can precompile your templates, which means that when you're creating dozens of templated items, that you can save yourself a good amount of processing time just by compiling early and not for each instance of your templated data.