embedded-ts v0.4.1
Embedded TypeScript (ETS)
A port of EJS to support embedded TypeScript.
Usage
import * as ets from 'embedded-ts';
console.log(
await ets.render(`
<%
let x: string
x = "hello";
%>
<%= x %>
`)
);
// Outputs: "hello"Differences from EJS
For simplicity and consistency, all render functions are now asynchronous, so there is no
asyncoption. This also means thatincludefunctions now return promises, so to include another.etsfile, you must useawait include('path/to/ets/file').There is no
clientoption in ETS.The
withstatement is now always used internally to expose provided data to the template. Thus, the_withanddestructuredLocalsoptions have been removed.The
strictoption has been removed; all templates are now executed in the context of a strict-mode asynchronous IIFE.The option to set global delimiters, opening brackets, and closing brackets through
ets.delimiter = '?'has been removed. Instead, pass the delimiter to each render function or create a wrapper function.