3 ms·
this seems to work with static assets, so no need for a old php server. But also you don't need much more than those lines of JS: document.addEventListener(
by meiraleal 2y ago
this seems to work with static assets, so no need for a old php server.
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>\`)});