method TemplateProcessor.prototype.processTemplate
TemplateProcessor.prototype.processTemplate(
template: string,
): Promise<string>

Process a template string with data using Vento

Compiles and renders a template with enhanced data preparation. Throws descriptive errors for template compilation or rendering failures.

Examples

Example 1

const template = 'Version: {{ version }}, Components: {{ versionComponents |> jsonStringify }}';
const result = await processor.processTemplate(template, templateData);

Parameters

template: string
  • Template string with Vento syntax
  • Template data object

Return Type

Promise<string>

Rendered template string

Throws

Error if template processing fails

Usage

import { TemplateProcessor } from ".";