code: func New(port int) transform.Transformer {
  	return func(ft transform.FromTo) error {
  		b := ft.From().Bytes()
  		endBodyTag := "</body>"
  		match := []byte(endBodyTag)
  		replaceTemplate := `<script data-no-instant>document.write('<script src="/livereload.js?port=%d&mindelay=10"></' + 'script>')</script>%s`
  		replace := []byte(fmt.Sprintf(replaceTemplate, port, endBodyTag))
  
  		newcontent := bytes.Replace(b, match, replace, 1)
  		if len(newcontent) == len(b) {
  			endBodyTag = "</BODY>"
  			replace := []byte(fmt.Sprintf(replaceTemplate, port, endBodyTag))
  			match := []byte(endBodyTag)
  			newcontent = bytes.Replace(b, match, replace, 1)
  		}
  
  		if _, err := ft.To().Write(newcontent); err != nil {
  			helpers.DistinctWarnLog.Println("Failed to inject LiveReload script:", err)
  		}
  		return nil
  	}
  }
docs: // New creates a function that can be used
  // to inject a script tag for the livereload JavaScript in a HTML document.