Hudge Template Engine by - Fahid Mohammad
Hudge is a lightweight JavaScript template engine with a footprint of 1kb inspired by the article writen by Krasimir Tsone.
Include source to your project
<script src="hudge.js"></script>Dynamic template with hudge markdown (template.hudge)
<script type="text/x-tmpl" id="your-template-id">
<head>
<title>{%=_h.title %}</title>
</head>
<body>
<h1>{%= _h.headings %}</h1>
</body>
</script>Static Html page
<html id="loadTemplate"></html>Load dynamic template using jQuery to hudge with data object
var data = {
title:'My Title',
headings:'Hudge Template Engine',
};
$.get('template.hudge',{},function(template){
template = $(template);
var target = $('#loadTemplate');
var template =hudge(template.filter(template).html(),data);
target.empty().append(template);
});