diff options
author | Cameron Moore <[email protected]> | 2016-12-27 21:14:43 -0600 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2016-12-28 11:09:50 +0100 |
commit | 6affd31b3e6d4618743b055cc9bae2c11a875635 (patch) | |
tree | 275ac84daec7668d092e28e7b2448820ac6d6219 /livereload | |
parent | 88b5bbd5329a87046979e222a9ccf74eda59df3c (diff) | |
download | hugo-6affd31b3e6d4618743b055cc9bae2c11a875635.tar.gz hugo-6affd31b3e6d4618743b055cc9bae2c11a875635.zip |
livereload: Simplify RefreshPath
Diffstat (limited to 'livereload')
-rw-r--r-- | livereload/livereload.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/livereload/livereload.go b/livereload/livereload.go index a3309c49a..04e3ac0f0 100644 --- a/livereload/livereload.go +++ b/livereload/livereload.go @@ -38,7 +38,7 @@ package livereload import ( "net/http" - "strings" + "path/filepath" "github.com/gorilla/websocket" ) @@ -74,8 +74,8 @@ func ForceRefresh() { // will be updated in the browser, not the entire page. func RefreshPath(s string) { // Tell livereload a file has changed - will force a hard refresh if not CSS or an image - urlPath := strings.Replace(s, "\\", "/", -1) // If path has backslashes on Windows, make path work for URL - wsHub.broadcast <- []byte(`{"command":"reload","path":"` + urlPath + "\"" + `,"originalPath":"","liveCSS":true,"liveImg":true}`) + urlPath := filepath.ToSlash(s) + wsHub.broadcast <- []byte(`{"command":"reload","path":"` + urlPath + `","originalPath":"","liveCSS":true,"liveImg":true}`) } // ServeJS serves the liverreload.js who's reference is injected into the page. |