@tmorin/ceb-templating-literal
Version:
The package is part of the `<ceb/>` library. It provides the implementation of a templating solution which leverages on the vanilla string literals.
21 lines (20 loc) • 939 B
TypeScript
import { UpdateParameters } from "@tmorin/ceb-templating-engine";
import { Template } from "@tmorin/ceb-templating-builder";
/**
* This function is a [tag function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates)
* which converts a [literal statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literal) to a {@link Template}.
* The template can then be used to update the DOM.
*
* @example Render a simple greeting
* ```typescript
* import {Template} from "@tmorin/ceb-templating-builder"
* import {html} from "@tmorin/ceb-templating-literal"
* const name = "World"
* const template : Template = html`<p>Hello, ${name}!</p>`
* template.render(document.body)
* ```
*
* @param strings the strings
* @param args the arguments
*/
export declare function html(strings: TemplateStringsArray, ...args: Array<any>): Template<UpdateParameters>;