MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / injectLiveReload

Function injectLiveReload

src/artifacts/live-reload.ts:42–47  ·  view source on GitHub ↗
(html: string, channelPath: string = LIVE_CHANNEL_PATH)

Source from the content-addressed store, hash-verified

40 * artifacts are fragments without a body tag).
41 */
42export function injectLiveReload(html: string, channelPath: string = LIVE_CHANNEL_PATH): string {
43 const snippet = liveReloadClientScript(channelPath);
44 const idx = html.toLowerCase().lastIndexOf('</body>');
45 if (idx === -1) return html + snippet;
46 return html.slice(0, idx) + snippet + html.slice(idx);
47}
48
49/**
50 * A full HTML page shown when the current version can't be rendered (artifact deleted,

Callers 2

renderCurrentFunction · 0.85

Calls 1

liveReloadClientScriptFunction · 0.85

Tested by

no test coverage detected