https://github.com/cran/pkgdown
Raw File
Tip revision: ba93f092d777b1d40f9dfca5a0b804b46b7dee5b authored by Hadley Wickham on 20 November 2018, 19:00:03 UTC
version 1.2.0
Tip revision: ba93f09
preview.R
#' Open site in browser
#'
#' @inheritParams build_article
#' @param path Path relative to destination
#' @export
preview_site <- function(pkg = ".", path = ".", preview = NA) {
  pkg <- as_pkgdown(pkg)

  if (is.na(preview)) {
    preview <- interactive() && !is_testing()
  }

  if (preview) {
    rule("Previewing site")
    utils::browseURL(path(pkg$dst_path, path, "index.html"))
  }

  invisible()
}

is_testing <- function() {
  identical(Sys.getenv("TESTTHAT"), "true")
}
back to top