@molecule/api-templating-handlebars
v1.0.1
Published
Handlebars template provider for molecule.dev
Maintainers
Readme
@molecule/api-templating-handlebars
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Handlebars template provider for molecule.dev.
Implements the TemplateProvider interface using the Handlebars template
engine. Supports Mustache-compatible syntax with helpers, partials, and
pre-compiled templates for fast rendering.
Quick Start
import { setProvider } from '@molecule/api-templating'
import { provider } from '@molecule/api-templating-handlebars'
setProvider(provider)Type
provider
Installation
npm install @molecule/api-templating-handlebars @molecule/api-templating handlebarsAPI
Interfaces
HandlebarsTemplateConfig
Configuration options for the Handlebars template provider.
interface HandlebarsTemplateConfig {
/** Whether to HTML-escape output by default. Defaults to `true`. */
escape?: boolean
/**
* Built-in helpers to register on creation.
* Keys are helper names, values are helper functions.
*/
helpers?: Record<string, (...args: unknown[]) => string>
/**
* Built-in partials to register on creation.
* Keys are partial names, values are partial template strings.
*/
partials?: Record<string, string>
}Functions
createProvider(config)
Creates a Handlebars template provider.
function createProvider(config?: HandlebarsTemplateConfig): TemplateProviderconfig— Provider configuration.
Returns: A TemplateProvider backed by Handlebars.
Constants
provider
The provider implementation with default configuration.
const provider: TemplateProviderCore Interface
Implements @molecule/api-templating interface.
Bond Wiring
Setup function to register this provider with the core interface:
import { setProvider } from '@molecule/api-templating'
import { provider } from '@molecule/api-templating-handlebars'
export function setupTemplatingHandlebars(): void {
setProvider(provider)
}Injection Notes
Requirements
Peer dependencies:
@molecule/api-templating^1.0.1
Runtime Dependencies
@molecule/api-templatinghandlebars
