Liquid JS

Color me impressed.

Matt Mccray ported Liquid to javascript. Go here to get the gist of it (yea, bad pun)

Pretty awesome work Matt :-)


<script>
 Liquid.readTemplateFile = function(path) {
  var elem = $(path);
  if(elem) {
    return elem.innerHTML;
  } else {
    path +" can't be found."; // Or throw and error, or whatever you want...
  }
 }

 var tmpl = Liquid.parse("Include file ''myOtherTemplate' with current_user' contains invalid characters or sequences"); 
 alert( tmpl.render({ current_user:'M@' }));
</script>

<script type="text/liquid" id="myOtherTemplate">
  Hello, !
</script>