tundrajs

The comprehensive template engine

Usage no npm install needed!

<script type="module">
  import tundrajs from 'https://cdn.skypack.dev/tundrajs';
</script>

README

Tundra logo
Tundra

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.

Features

  • Easy to learn and lightweight.

  • Standard library with useful functions.

  • Customizable syntax.

  • Inheritance capabilities.

  • Reusable code blocks.

And much more...

Code snippets

{{ 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 ]}

Example

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);

Tests

To run the test suite, follow these steps:

  1. Open your terminal and move to your Tundra folder.

  2. Run npm update --save-dev to install the dependencies.

  3. Run npm test.

Documentation

The documentation is available at the wiki page.

VSC Extension

There's a syntax highlighting extension of Tundra available for Visual Studio Code, download it here:

Tundra - Visual Studio Marketplace

Contributing

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 :)

License

Tundra is open-source software licensed under the MIT license.