(html: string, channelPath: string = LIVE_CHANNEL_PATH)
| 40 | * artifacts are fragments without a body tag). |
| 41 | */ |
| 42 | export 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, |
no test coverage detected