Skip to content
Advertisement

JavaScript Template Engines that don’t require Node

I have experimented with several of the template engines that work with Express. I am looking for an engine that can work in a single HTML file by adding the CDN link; in other words, a non-Node project, no WebPack, no Gulp files. Just an HTML and javascript files.

So far, I’ve found that Mustache can do this. Are there any others that can do this? I have been googling for a list of engines but have not found one yet.

Advertisement

Answer

You should take a look at pure.js

It allows you to parse html templates just with the use of javascript. No node, webpack or other things.

https://pure-js.com/

The template:

<div>
   Hello <span></span>
</div>

How to render it:

var data = {
    who:'BeeBole!' //the JSON data
},

directive = {
    'span':'who' //make the link between the HTML SPAN tag and the JSON property "who".
};

$( 'div' ).render( data, directive );  //render the result
Advertisement