Skip to content

Commit

Permalink
Refactor serve.jl (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikhuijzer authored Oct 19, 2021
1 parent 065b389 commit cd081b7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/serve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ function custom_callback(file::AbstractString, project::AbstractString)
LiveServer.file_changed_callback(file)
end


function default_simplewatcher(project, extra_directories)
function custom_simplewatcher(project, extra_directories)
# The callback, defined by LiveServer.jl, receives a file.
cb = file -> custom_callback(file, project)
cb(file) = custom_callback(file, project)
sw = LiveServer.SimpleWatcher(cb)

for (root, dirs, files) in walkdir(".")
Expand All @@ -55,7 +54,7 @@ function serve(; simplewatcher=nothing, host::String="127.0.0.1",

if isnothing(simplewatcher)
extra_directories = config(project, "extra_directories")
simplewatcher = default_simplewatcher(project, extra_directories)
simplewatcher = custom_simplewatcher(project, extra_directories)
end
mkpath(dir)
html(; project)
Expand Down

0 comments on commit cd081b7

Please sign in to comment.