An open API service indexing awesome lists of open source software.

https://github.com/tani/deno-template

ejs in sandbox
https://github.com/tani/deno-template

Last synced: 2 months ago
JSON representation

ejs in sandbox

Awesome Lists containing this project

README

        

# Deno Template - ejs in sandbox

This is a tiny template library for Node/ Deno projects.
Most of ejs flavored template engine depend on `eval` or `Function`.
However, this is a problematic for non-standard JavaScript runtime such as Deno Deploy.
Thus, we enables `eval` using a sandbox Javascript interpreter written in JavaScript.
It might be slower than other templating library. Anyway, enjoy ejs template ;)

## Usage

```js
import { compile } from "https://pax.deno.dev/tani/deno-template"
const name = "John"
const template = compile("<% for (let i = 0; i < 10; i++) { %> Hi, <%- name %>! <% } %>")
console.log(await template({ name })
```