@ralphwetzel/node-red-contrib-eta 1.0.0
A node to utilize Eta - the lightweight, powerful, pluggable embedded JS template engine.

A Node-RED node to utilize Eta - the lightweight, powerful, pluggable embedded JS template engine.
Inputs
msg
(object) : (standard) message object with data to be used for redering the __root__ template.
Outputs
payload
(string) : the result of redering the __root__ template with the data provided as input.
Details
This nodes allows to render a document template (named __root__) by utilizing the Eta JS template engine. For help regarding the template syntax refer to the Eta Syntax Overview website.
If you've enabled the use of the Monaco text editor, syntax highlighting support is provided.
The document template (__root__) shall be defined in the configuration options of this node.
Data provided to the node may be accessed in the template via a variable called it
.
<% /*
This is the Eta root template.
You may add further templates to define
partials or layouts.
Check https://eta.js.org for syntax
support.
*/ -%>
<% = it.msg.payload + "! Wow!" %>
To use partials, you may define additional templates in the configuration options of this node.
Using those partials follows the standard Eta scheme; the data (object) again may be accessed - within the partial - via it
.
<%~ include(template_name, {msg: it.msg}) %>
Please be aware that file partials are not supported!
An example:
The __root__ document template:
The template of the partial - to be included:
You may import this example as well via the Node-RED Import menu option.