Precompile templates

@millermedeiros 

Many thanks for your contribution.

I've merged your code, included the runtime library, and added a few options to main.js so it works with build.sh and produces the example build. 

I really don't have time for the tests right now, but at least we have an automated example to validate the changes.

Comments, suggestions?

@Saturate, @Marsup, @SBoudrias