Convert template spec to object literal

This allows for metadata to be associated with the template and a simplification of the template init logic.
Merge pull request #729 from wycats/precompile-literal

Convert template spec to object literal