Fix for initial resultTemplate parse when there are multiple script assets

I had an issue where the generated pages would have invalid markup in the `<head>` because of some `<\/script>` nodes with the `\/` escape sequence not being replaced.

It seems that `.replace('\\/script', '/script');` does not replace all occurrences, even if using regex and specifying the 'g' flag.

This change fixes the issue by running the replace operation until `indexOf('\\/script') === -1`