Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/eta/compile-string.ts>default

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript
Go to Latest
function default
import { default } from "https://deno.land/x/eta@v2.2.0/compile-string.ts";

Compiles a template string to a function string. Most often users just use compile(), which calls compileToString and creates a new function using the result

Example

compileToString("Hi <%= it.user %>", eta.config)
// "var tR='',include=E.include.bind(E),includeFile=E.includeFile.bind(E);tR+='Hi ';tR+=E.e(it.user);if(cb){cb(null,tR)} return tR"

Parameters

str: string
config: EtaConfig

Returns

string