You've been looking for a more sophisticated templating engine for JavaScript. Here it is.
Torsten Raudssus sur Twitter : "It is simple, if you don't have the opening tag and the closing tag in the same template file, then you are using the wrong template engine."