create-html-template-element
v1.0.0
Published
Create an HTML <template> with content.
Downloads
1
Readme
create-html-template-element
Create an HTML
<template>
with content.
Installation
Node.js >= 10
is required. To install, type this at the command line:
npm install create-html-template-element
Importing
ES Module:
import html from 'create-html-template-element';
CommonJS Module:
const html = require('create-html-template-element');
Usage
As a tagged template literal:
const TEMPLATE = html`
<elm attr="val">txt</elm>
`;
//-> HTMLTemplateElement
As a regular function:
const TEMPLATE = html(`
<elm attr="val">txt</elm>
`);
//-> HTMLTemplateElement
With custom document
(useful for jsdom):
const TEMPLATE = html(`<elm attr="val">txt</elm>`, iframe.contentWindow.document);
//-> HTMLTemplateElement