The comprehensive template engine for Nodejs.
Tundra is a small, fast, customizable and easy to use template engine. It perfectly integrates with any back-end made in Js, even pure Nodejs.
Easy to learn and lightweight.
Standard library with useful functions.
Customizable syntax.
Inheritance capabilities.
Reusable code blocks.
And much 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 web server is this simple:
var http = require('http');
var Tundra = require('tundrajs');
var view = new Tundra();
http.createServer((req, res) => {
view.render(res, '<p>{{ msg }}<p>', {
msg: 'Hello World!',
});
res.end();
}).listen(8080);
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.
There's a syntax highlighting extension of Tundra available for Visual Studio Code, download it here:
Any contribution or support to this project in the form of a issue, pull request or message will be highly appreciated. ❤️
You can read more about it right here. Don't be shy :)
Tundra is open-source software licensed under the MIT license.