@muban/template
Version:
Writing templates for Muban components during development
27 lines (26 loc) • 1.25 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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsonScriptTemplate = void 0;
/* eslint-disable @typescript-eslint/no-explicit-any */
var mtl_1 = require("../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
*/
function jsonScriptTemplate(content) {
return (0, mtl_1.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),
});
}
exports.jsonScriptTemplate = jsonScriptTemplate;
var templateObject_1;