R/serve_site.R

Defines functions serve_site

Documented in serve_site

#' Serve site
#'
#' @param path (character) Optional. Directory to serve. Defaults to
#'  \code{docs}.
#'
#' @return Nothing.
#' @export
#'
#' @examples
#' \dontrun{
#' # Build your site
#' json <- write_json(biblio, access, attributes, creators)
#' build_site(json)
#'
#' # Serve it
#' serve_site()
#' }
serve_site <- function(path = "docs") {
  if (!requireNamespace("servr")) {
    stop("Please install 'servr' to serve your site: install.packages('servr')",
         call. = FALSE)
  }

  servr::httd("docs")
}

Try the dataspice package in your browser

Any scripts or data that you put into this service are public.

dataspice documentation built on May 17, 2021, 1:09 a.m.