@muban/template
Version:
Writing templates for Muban components during development
23 lines (22 loc) • 1.08 kB
JavaScript
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
/* eslint-disable @typescript-eslint/no-explicit-any */
import { html } from '../mtl';
/**
* Helper function to render JSON script tags with a JS data structure
* Useful to render properties for components that contain a bit more data
* than is practical for using data-attributes
*
* TODO: add this as part of the future helper function to render component containers
*
* @param content
*/
export function jsonScriptTemplate(content) {
return html(templateObject_1 || (templateObject_1 = __makeTemplateObject(["<script\n type=\"application/json\"\n dangerouslySetInnerHTML=", "\n ></script>"], ["<script\n type=\"application/json\"\n dangerouslySetInnerHTML=", "\n ></script>"])), {
// eslint-disable-next-line @typescript-eslint/naming-convention
__html: JSON.stringify(content),
});
}
var templateObject_1;