The function serve_site() calls servr::httw() to start a
web server, watch for changes in the site, rebuild the site if necessary, and
refresh the web page automatically by default; stop_server() stops the
web server.
serve_site(...)stop_server()
Arguments passed to servr::httw() (arguments dir,
site.dir, baseurl, and handler have been provided,
hence you cannot customize these arguments).
Alternatively, you can set the global option
options(blogdown.generator.server = TRUE), and
serve_site() will use the web server provided by the static site
generator, such as hugo_server(). This requires additional
packages processx and later. You may use this option when you
primarily work on plain Markdown posts instead of R Markdown posts, because
it can be faster to preview Markdown posts using the web server of the static
site generator. The web server will always be stopped when the R session is
ended, so you may consider restarting your R session if stop_server
fails to stop the server for some reason.