pkgdown::preview_site() opens docs/index.html as a file:// URL. Many
browsers restrict loading stylesheets, scripts, and fonts from local files, so
the site can appear almost unstyled. This function serves docs/ over HTTP
on the loopback interface so the site matches the published GitHub Pages
appearance.
Details
Call from the package root after pkgdown::build_site() (or any build
that populates docs/).
The server runs until you interrupt the R session (e.g. Esc in RStudio or Ctrl+C in the terminal).
Examples
if (FALSE) { # \dontrun{
pkgdown::build_site()
preview_pkgdown_site()
} # }