Create an HTML
<template>
with content.
Node.js >= 10
is required. To install, type this at the command line:
npm install create-html-template-element
ES Module:
import createHTMLTemplateElement from 'create-html-template-element';
CommonJS Module:
const createHTMLTemplateElement = require('create-html-template-element');
As a tagged template literal (notice the syntax highlighting):
const html = createHTMLTemplateElement;
const TEMPLATE = html`
<elm attr="val">txt</elm>
`;
//-> HTMLTemplateElement
As a regular function:
const TEMPLATE = createHTMLTemplateElement(`<elm attr="val">txt</elm>`);
//-> HTMLTemplateElement