https://github.com/cran/pkgdown
Tip revision: df465aa02367bc8bf2fa3f2e3827be5f8713569a authored by Hadley Wickham on 03 December 2021, 09:00:02 UTC
version 2.0.1
version 2.0.1
Tip revision: df465aa
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")
}