madrobby/zepto — Issue #310: Templates
Author: milesplit
Created: 2011-11-15 07:35:30+00:00
State: open

I apologize if this is not the proper way to submit ideas... not up on the proper Github etiquette.

I understand if it's not "core" enough to be considered, but a basic templating system can be implemented with very minimal code:

$.fn.tmpl=function(a){var b=$(this[0]).html().trim();if(a){for(k in a){b=b.replace(new RegExp("\\${"+k+"}","g"),a[k])}}return $(b)}

Here it is with not minified with some comments:

https://gist.github.com/1366395

Hopefully maybe it's something you may want to put into the core... or if if not then someone will find useful.