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
- Host: GitHub
- URL: https://github.com/tani/deno-template
- Owner: tani
- Created: 2022-04-14T13:20:48.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-25T05:41:42.000Z (over 1 year ago)
- Last Synced: 2025-02-09T23:50:03.991Z (4 months ago)
- Language: TypeScript
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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 })
```