Here is a typical
sjs-4 code example:
var p = ''; p += '<div>'; p += 'Hello from: <b>'+util.htmlEncode(f.title())+'</b>'; p += '</div>'; response.body(p);
It works, but it is ugly, especially if you throw even more HTML into the code. It would be so much nicer to embed the JS code into HTML, instead of the other way around.
This is precisely what the
sjs-4e engine allows you to do. It is a dialect of
sjs-4 engine. Before executing
sjs-4e code, it will be transpiled to
Here is the same code as above written in
<div> Hello from: <b><?= f.title() ?></b> </div>
There are only a couple of syntax elements to be aware of:
<? ... ?>,
<?= foo ?>,
<?== foo ?>,
You can find more info and example code snippets in the sjs-4e docs.