create-html-template-element
v1.0.0
Published
Create an HTML <template> with content.
Downloads
3
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-elementImporting
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>
`;
//-> HTMLTemplateElementAs a regular function:
const TEMPLATE = html(`
<elm attr="val">txt</elm>
`);
//-> HTMLTemplateElementWith custom document (useful for jsdom):
const TEMPLATE = html(`<elm attr="val">txt</elm>`, iframe.contentWindow.document);
//-> HTMLTemplateElement