1.0.0 • Published 6 years ago

htemplater v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

Templater

HTML Render Engine

Example

var express = require('express');
var app = express();
var Templater = require('htemplater');
var templater = new Templater('./views/','./templates/',app);

templater.Enable().Dynamic();

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});

new Templater(viewsFolder,templatesFolder,app);

Content in viewsFolder:

index.html

Content in index.html

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	#header#
	<br>
	<br>
	#body#
</body>
</html>

Content in templatesFolder

body.html header.html

Content in body.html

<h2>this</h2>
<h3>is</h3>
<h4>the</h4>
<h5>body</h5>

Content in header.html

<div class="container">
	<h1>This is the content of Header</h1>
</div>

on /index.html request

result:

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	<div class="container">
		<h1>This is the content of Header</h1>
	</div>
	<br>
	<br>
	<h2>this</h2>
	<h3>is</h3>
	<h4>the</h4>
	<h5>body</h5>
</body>
</html>