Show HN: Hmpl – work with server-side HTML with ease
hmpljs.github.io
hmpljs.github.io
But also you don't need much more than those lines of JS:
document.addEventListener('DOMContentLoaded', () => {
const t = document.querySelector('template[data-hmpl]');
t && fetch(t.dataset.src, { method: t.dataset.method })
.then(res => res.text())
.then(html => t.outerHTML = \`<div>\${html}</div>\`)});