import eryn from 'eryn';
app.get('/', (res, req) => {
const data = eryn.render('home.eryn', {
name: 'John Smith'
});
res.end(data);
});
<!doctype html>
<html>
<body>
<!-- Import navbar -->
[|% navbar.eryn : context /|]
<!-- Content of page -->
<h1>Home</h1>
</body>
</html>
<nav>
<a href="/">
Home
</a>
<a href="/profile">
Welcome back, [| context.name |]
</a>
</nav>
npm i eryn --save
import
eryn
from
'eryn';
eryn.
render
('universe');
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|]
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>
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
});
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: '}}',
});
Eryn approaches native speeds, while also being easy to use in Node.js applications.
Something doesn't work? Eryn shows you where the error occurred, and tells you exactly what happened.
Eryn supports a lot of options which can be tuned individually.
Eryn works with any file type: HTML, CSS, JS, SVG, and even binary ones.
Eryn has zero Node dependencies for production.
Eryn, and all tools used by it, are licensed under the MIT license.
Simple, easy-to-understand, and complete documentation
Eryn is actively maintained and updated with new features.