Skip to content

Commit

Permalink
Merge pull request #104 from taadis/master
Browse files Browse the repository at this point in the history
added:预览时,调用系统默认浏览器打开站点,方便查看
  • Loading branch information
imeoer authored Jul 14, 2018
2 parents 3443ffb + 422aaec commit 9d8f31e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/facebookgo/symwalk"
"github.com/fsnotify/fsnotify"
"github.com/gorilla/websocket"
"github.com/taadis/oper"
)

var watcher *fsnotify.Watcher
Expand Down Expand Up @@ -98,6 +99,8 @@ func Serve() {
previewWeb.Get("/live", Websocket)
previewWeb.Get("*", ink.Static(filepath.Join(rootPath, globalConfig.Build.Output)))

Log("Access http://localhost:" + globalConfig.Build.Port + "/ to open preview")
uri := "http://localhost:" + globalConfig.Build.Port + "/"
Log("Access " + uri + " to open preview")
oper.Access(uri)
previewWeb.Listen(":" + globalConfig.Build.Port)
}

0 comments on commit 9d8f31e

Please sign in to comment.