Created
May 8, 2015 10:28
-
-
Save MatthewBarker/dc5a6a147719c4166564 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*---------------------------------------------------------- | |
// Micro JavaScript Templating xtpl (minified version) | |
// Leo Lems - http://2basix.nl - MIT Licensed | |
------------------------------------------------------------*/ | |
(function(){this.xtpl=function xtpl(templatestring,data){var ret='',xfn=new Function("o","var arr=['"+templatestring.replace(/[\r\t\n]/g,"").split("'").join("\\'").replace(/{%=\s*\(\s*(.+?)\s*\)\s*%}/g,"',($1),'").replace(/{%=\s*(.+?)\s*%}/g,"',(o.$1)?o.$1:'','")+"']; return arr.join('');");if(!data){return xfn}return xfn(data)}})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment