htmlTemplate(options)
html
<title>{{ APP_TITLE }}</title>ts
htmlTemplate({
data: ({ mode }) => ({ APP_TITLE: mode === "production" ? "Fast" : "Fast Dev" }),
strict: true,
});Values are HTML-escaped by default. Unknown placeholders remain unless strict: true, which throws. Use escape: false only for fully trusted required raw markup.
htmlTemplate Template
Injects HTML template data and Vite HtmlTagDescriptor tags.
Signature
ts
export function htmlTemplate(options: HtmlTemplatePluginOptions): Plugin;Example
ts
import { htmlTemplate } from "fast-vite-plugins";
const plugin = htmlTemplate({ data: { APP_TITLE: "Fast Admin" }, strict: true });
export default { plugins: [plugin] };Input
| Input | Type | Required / default | Description |
|---|---|---|---|
options | HtmlTemplatePluginOptions | Required | Template data, extra tags, escaping, and strict settings. |
Returns
| Value | Type | Description |
|---|---|---|
plugin | Plugin | HTML-template plugin for Vite plugins. |
