Easy HTML-based template engine for Express
You can see tutorial here.
npm i express-template-engine
import engine from 'express-template-engine'; // ESM, Typescript
const engine = require('express-template-engine'); // CJS
// Set express template engine
app.engine('html', engine({ caching: false }));
app.set('view engine', 'html');
// Set views directory
app.set('views', path.resolve(__dirname, './views'));
// Use template engine
app.get('/', (req, res) => {
res.render('template', { ... });
});
<eval>val</eval>
<eval>javascript.code({});</eval>
<span>#{val}</span>
<repeat index="i" from="0" to="5">
<p>Run #{i} times.</p>
</repeat>
<repeat index="i" times="5">
<p>Run <eval>i</eval> times.</p>
</repeat>
<if condition="false">
<p>Content of IF</p>
</if>
<elif condition="val == 'cond'">
<p>Content of ELIF</p>
</elif>
<else>
<p>Content of ELSE</p>
</else>
<import src="another/template"></import>