Eryn is a fast and powerful native template engine for the Node.js runtime

index.js

import eryn from 'eryn'; app.get('/', (res, req) => { const data = eryn.render('home.eryn', { name: 'John Smith' }); res.end(data); });

home.eryn

<!doctype html> <html> <body> <!-- Import navbar --> [|% navbar.eryn : context /|] <!-- Content of page --> <h1>Home</h1> </body> </html>

navbar.eryn

<nav> <a href="/"> Home </a> <a href="/profile"> Welcome back, [| context.name |] </a> </nav>

Getting started

Step 1. Install

npm i eryn --save

Step 2. Import

import eryn from 'eryn';

Step 3. Render

eryn. render ('universe');

Everything you need

Eryn supports simple templates, if/else, loops, and even components.

The templates use JavaScript code, giving you a lot of control. [|! context.isLoggedIn |] You are not logged in [|:? context.isAdmin |] Hello, admin [| context.name |] [|:|] Hello, user [| context.name |] [|end|]

Don't repeat yourself

Need to include an article element on multiple HTML pages?

Eryn supports components with optional content, which can be used anywhere. [|% article.eryn : { title: 'Home' } |] This is the article content [|end|] <article> <h1>[| context.title |]</h1> [| content |] </article>

Built-in cache

Eryn compiles and caches templates for later use. This makes the render process faster. Need to disable the cache during development? eryn.setOptions({ bypassCache: true });

Customizability

Don't like the syntax? No problem.

Eryn lets you change a lot of options, including most of the syntax elements. eryn.setOptions({ templateStart: '{{', templateEnd: '}}', });

Features

High performance

Eryn approaches native speeds, while also being easy to use in Node.js applications.

Friendly error messages

Something doesn't work? Eryn shows you where the error occurred, and tells you exactly what happened.

Modularity

Eryn supports a lot of options which can be tuned individually.

Unlimited file support

Eryn works with any file type: HTML, CSS, JS, SVG, and even binary ones.

No Node.js dependencies

Eryn has zero Node dependencies for production.

MIT License

Eryn, and all tools used by it, are licensed under the MIT license.

Good documentation

Simple, easy-to-understand, and complete documentation

Maintained

Eryn is actively maintained and updated with new features.