Compiling templates
Adding template directories
First of all, Hawkejs needs to know where your templates are. You can add multiple directories using the Hawkejs#addViewDirectory method:
var hawkejs = new Hawkejs();
hawkejs.addViewDirectory('/path/to/templates');From then on it will look in those directories anytime a template is wanted. Paths are always interpreted as absolute, so starting with a forward slash in your templates is not required.
Compile example
Hawkejs will compile your templates into functions. These functions will create a virtual DOM, so it is important to write valid HTML (+ the allowed extra Hawkejs syntax)
Take this simple hawkejs template:
<% start('my-block'); %><div class="my-class">
<% $0.setAttribute('id', 'test') %>
<p>
		This is regular text.
		Let's print a variable: {%= some_variable %}
</p></div><% end('my-block') %>This will be compiled into a function that looks like this (formatting has been changed, some error catching methods have been removed):
function compiledView(__render, __template, vars, helper) {
	__render.start('my-block');
		__render.print("\n");
		__render.printElement("div", {attributes: {"class": "my-class"}});
			__render.print("\n\t");
			__render.$0.setAttribute('id', 'test');
			__render.print("\n\t");
			__render.printElement("p");
				__render.print("\n\t\tThis is regular text\n\t\tLet's print a variable: ");
				(__render.startExpression("Print", [{"variable":["some_variable"]}], vars).close());
				__render.print("\n\t");
			__render.closeElement("p");
			__render.print("\n");
		__render.closeElement("div");
		__render.print("\n");
	__render.end('my-block');
}As you can see, you can use both the EJS (<% %>) and Hawkejs ({% %}) syntax in the same template.