replaceRequireScript fix for conditional html in head and for django template tags

If html have some conditional html or template tags in start of the
file, they get messed up because of template parsing.
Presently we don’t parse the html, we use regex to find script tag and
then replace it.