Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Yandlebars

import { Yandlebars } from "https://raw.githubusercontent.com/cybertim/yandlebars/main/mod.ts";

Yet Another Handlebars for Deno

class Yandlebars {
constructor(config?: HandlebarsConfig);
private compileCache: Map<string, Template>;
private config: HandlebarsConfig;
 
registerBasicHelper(name: string, func: (value: string) => string);
registerPartial(name: string, template: string);
async render(view: string, context: Record<string, unknown>);
}

§Constructors

§
new Yandlebars(config?: HandlebarsConfig)
[src]

§Properties

§
compileCache: Map<string, Template>
[src]
§
config: HandlebarsConfig
[src]

§Methods

§
registerBasicHelper(name: string, func: (value: string) => string)
[src]

register a basic helper with name as template element

yandlebars.registerBasicHelper("hello", (value: string) => {
    return "hello " + value;
});
@param name
@param func
§
registerPartial(name: string, template: string)
[src]

register more partials all files in the config.partialDir are automatically registered

@param name
@param template
§
render(view: string, context: Record<string, unknown>)
[src]

render a template from the config.baseDir

const yandlebars = new Yandlebars();
await yandlebars.render("index", {"greeting": "hello"});
@param view
@param context