# Use pkgdown.offline

pkgdown.offline supports offline builds of pkgdown websites. It implements identically named functions to mask the original site initialization and site building functions for convenient drop-in replacements in your environment-constrained development or CI/CD workflows that cannot access the internet.

## Try it out locally

To test the offline build workflow, first clear the pkgdown external frontend dependencies cache that might exist in your environment:

    pkgdown.offline::clear_cache()

Create a new package. For example:

    usethis::create_package(file.path(tempdir(), "pkg"))

Switch off internet connection. In the new project, run:

    usethis::use_pkgdown()
    pkgdown.offline::build_site()

## Use in production environments

In practice, you can replace `pkgdown::build_site()` calls with `pkgdown.offline::build_site()` in your wrapper function or CI/CD workflow to achieve offline builds. Similarly, you can use `pkgdown.offline::init_site()` if a `pkgdown::init_site()` step was involved in your workflow.