Reusable template stamper — configure once, stamp many.
Caches an HTML <template> element and a base configuration map. Each stamp() call clones the template, merges per-instance data over the base config, and returns a DomCollection.
<template>
stamp()
const card = new TemplateStamper('#user-card', { map: { '.username': { css: { fontWeight: 'bold' } }, '.view-btn': { on: { click: handler } } } }); card.stamp({ '.username': 'Alice' }).into(container); card.stamp(users, u => ({ '.username': u.name })).into(container); Copy
const card = new TemplateStamper('#user-card', { map: { '.username': { css: { fontWeight: 'bold' } }, '.view-btn': { on: { click: handler } } } }); card.stamp({ '.username': 'Alice' }).into(container); card.stamp(users, u => ({ '.username': u.name })).into(container);
Optional
Reusable template stamper — configure once, stamp many.
Caches an HTML
<template>element and a base configuration map. Eachstamp()call clones the template, merges per-instance data over the base config, and returns a DomCollection.Example