Skip to content

Commit 52b4efa

Browse files
committed
patch release with launch browser
1 parent 16b24aa commit 52b4efa

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LiveServer"
22
uuid = "16fef848-5104-11e9-1b77-fb7a48bbb589"
33
authors = ["Jonas Asprion <jonas.asprion@gmx.ch", "Thibaut Lienart <tlienart@me.com>"]
4-
version = "0.5.5"
4+
version = "0.5.6"
55

66
[deps]
77
Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"

src/server.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# NOTE: this is copied from Pluto.
21
"""
32
open_in_default_browser(url)
43
5-
Open a URL in system default browser.
4+
Open a URL in the ambient default browser.
5+
6+
Note: this was copied from Pluto.jl.
67
"""
78
function open_in_default_browser(url::AbstractString)::Bool
89
try
@@ -241,17 +242,16 @@ directory. (See also [`example`](@ref) for an example folder).
241242
* `dir` specifies where to launch the server if not the current working directory.
242243
* `verbose` is a boolean switch to make the server print information about file changes and connections.
243244
* `coreloopfun` specifies a function which can be run every 0.1 second while the liveserver is going; it takes two arguments: the cycle counter and the filewatcher. By default the coreloop does nothing.
244-
* `launch_browser=false` is a boolean switch to choose launch the browser at host url.
245+
* `launch_browser=false` specifies whether to launch the ambient browser at the localhost URL or not.
245246
246247
# Example
247248
248249
```julia
249250
LiveServer.example()
250-
serve(host="127.0.0.1", port=8080, dir="example", verbose=true)
251+
serve(host="127.0.0.1", port=8080, dir="example", verbose=true, launch_browser=true)
251252
```
252253
253-
If you open a browser to `http://127.0.0.1:8080/`, you should see the `index.html` page from the
254-
`example` folder being rendered. If you change the file, the browser will automatically reload the
254+
You should then see the `index.html` page from the `example` folder being rendered. If you change the file, the browser will automatically reload the
255255
page and show the changes.
256256
"""
257257
function serve(fw::FileWatcher=SimpleWatcher(file_changed_callback);

src/utils.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,14 @@ assumed that they are in `docs/src`.
122122
* `skip_dirs=[]` same as `skip_dir` but for a vector of such dirs. Takes precedence over `skip_dir`.
123123
* `foldername="docs"` specify the name of the content folder if different than "docs".
124124
* `buildfoldername="build"` specify the name of the build folder if different than "build".
125-
* `launch_browser=false` is a boolean switch to choose launch the browser at host url.
125+
* `launch_browser=false` specifies whether to launch the ambient browser at the localhost URL or not.
126126
"""
127-
function servedocs(; verbose::Bool=false, literate::String="", doc_env::Bool=false,
128-
skip_dir::String="", skip_dirs::Vector{String}=String[],
129-
foldername::String="docs", buildfoldername::String="build", launch_browser::Bool = false)
127+
function servedocs(; verbose::Bool=false, literate::String="",
128+
doc_env::Bool=false, skip_dir::String="",
129+
skip_dirs::Vector{String}=String[],
130+
foldername::String="docs",
131+
buildfoldername::String="build",
132+
launch_browser::Bool = false)
130133
# Custom file watcher: it's the standard `SimpleWatcher` but with a custom callback.
131134
docwatcher = SimpleWatcher()
132135

0 commit comments

Comments
 (0)