paularmstrong/swig — pull request #171 by jshirley (2012-12-23 14:54:24+00:00)
Title: Add a precompile/registerTemplate feature for server-side processing

Hi!

Thanks for Swig, I enjoy using it much more than Handlebars. One feature that Handlebars has that was sorely missed is the ability to generate the parsed templates on the server-side and deliver them to the client (or build them as part of a process and bundle compiled templates). The only reason for this is performance, and it's very noticeable on mobile/phonegap implementations.

I've added this feature, with a unit test and docs. It was pretty easy to get everything working, however the only thing that I wasn't entirely happy with is keeping a reference to the generated code in the resulting template object. I don't think this is going to be a big deal, but we can think of some other and more efficient way for that if you'd like!

Thanks and Happy Holidays!

-Jay