Cotonti/Cotonti — Issue #826: Client-side CoTemplate parser
Author: GHengeveld
Created: 2012-02-05 10:58:53+00:00
State: open

A recent and very promising development in the world of webdevelopment is client-side templating using JavaScript. Various JavaScript Template Engines (JTE) have already been written, including Mustache.js, Dust.js, jQote and handlebars. A nice comparison done by the LinkedIn development team is here: http://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more

My idea is to modify one of the existing JTE's to match the CoTemplate syntax. This will allow us to use our existing .tpl files on the client side. Mustache.js allows you to change tag delimiters, so we can use {TAG} instead of {{TAG}}. However, logic blocks will require a bit more work. Maybe it's easier to use PHP to pre-parse a .tpl to match Mustache's syntax. We'll have to introduce a way to get the raw .tpl anyway.