embedded-ts
v0.4.1
Published
Embedded TypeScript.
Downloads
19
Readme
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
async
option. This also means thatinclude
functions now return promises, so to include another.ets
file, you must useawait include('path/to/ets/file')
.There is no
client
option in ETS.The
with
statement is now always used internally to expose provided data to the template. Thus, the_with
anddestructuredLocals
options have been removed.The
strict
option 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.