Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/nunjucks/mod.d.ts>default.Environment

A powerful templating engine with inheritance, asynchronous control, and more (Jinja 2 inspired) — ❌ Deprecated: use the `npm:` specifier instead
Latest
class default.Environment
import { default } from "https://deno.land/x/nunjucks@3.2.4/mod.d.ts";
const { Environment } = default;

Constructors

new
Environment(loader?: ILoader | ILoader[] | null, opts?: ConfigureOptions)

Properties

options: { autoescape: boolean; }

Methods

addExtension(name: string, ext: Extension): Environment
addFilter(
name: string,
func: (...args: any[]) => any,
async?: boolean,
): Environment
addGlobal(name: string, value: any): Environment
express(app: Record<string, unknown>): void
getExtension(name: string): Extension
getFilter(name: string): (...args: any[]) => any
getGlobal(name: string): any
getTemplate(name: string, eagerCompile?: boolean): Template
getTemplate(
name: string,
eagerCompile?: boolean,
callback?: Callback<Error, Template>,
): void
hasExtension(name: string): boolean
on(event: "load", fn: (
name: string,
source: { src: string; path: string; noCache: boolean; },
loader: Loader,
) => void
): void
removeExtension(name: string): void
render(name: string, context?: Record<string, unknown>): string
render(
name: string,
context?: Record<string, unknown>,
callback?: TemplateCallback<string>,
): void
renderString(name: string, context: Record<string, unknown>): string
renderString(
name: string,
context: Record<string, unknown>,
callback?: TemplateCallback<string>,
): void