The comprehensive template engine for Nodejs.
Tundra is a small, fast, customizable and easy to use template engine for Nodejs. It perfectly integrates with any back-end made in Js, even pure Nodejs.
-
Easy to learn and with a small codebase.
-
Cache system for speeding up the loading of views.
-
Standard library with useful functions.
-
Customizable syntax.
-
Inheritance capabilities.
-
Reusable code blocks.
-
And more...
{{ print_variable }}
{! print_variable_without_escaping_it !}
{# comment #}
{% var code_inside_this_tags = true %}
~{{ escape_template_tags }}
@require(imported_view.html)
@spread(hello)
{[ spread hello ]}
{[ endspread ]}
@extends(parent_view.html)
{[ block name ]}
{[ parent block_name ]}
{[ endblock ]}
Rendering a view in pure Nodejs is this simple:
main.js:
var http = require('http');
var Tundra = require('tundrajs');
var view = new Tundra();
http.createServer((req, res) => {
let data = {
title: 'Tundra',
msg: 'Hello World!'
};
view.render(res, 'home.html', data);
res.end();
}).listen(8080);
home.html:
<!DOCTYPE html>
<head>
<title>{{ title }}</title>
</head>
<body>
{{ msg }}
</body>
</html>
To run the test suite, follow these steps:
-
Open your terminal and move to your Tundra folder.
-
Run
npm update --save-dev
to install the dependencies. -
Run
npm test
.
The documentation is available at the wiki page.
Any contribution or support to this project in the form of a issue, pull request or message will be highly appreciated. ❤️
Don't be shy :)
Tundra is open-source software licensed under the MIT license.