diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index a095e3b7..07a951b6 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -626,15 +626,17 @@ impl Site { } /// Inject live reload script tag if in live reload mode - fn inject_livereload(&self, html: String) -> String { + fn inject_livereload(&self, mut html: String) -> String { if let Some(port) = self.live_reload { - return html.replace( - "", - &format!( - r#""#, - port - ), + let script = format!( + r#""#, + port, ); + if let Some(index) = html.rfind("") { + html.insert_str(index, &script); + } else { + html.push_str(&script); + } } html