This vignette is intended for pkgdown.offline developers only.
How it works
pkgdown.offline retrieves the cached frontend dependencies from each
pkgdown version (>= 2.1.0) and bundle them in the package. The cache
is then used by the functions like
pkgdown.offline::init_site()
and
pkgdown.offline::build_site()
to support offline build
workflows.
Every time a new pkgdown version is released on CRAN, the new version support should be verified and potentially updated by the pkgdown.offline developer. pkgdown.offline also optimizes its package size by deduplicating these cache files across different pkgdown versions.
Retrieve raw pkgdown external dependencies
Clone the repository. Open the project. Source the developer maintenance script:
source("tools/tools.R")
Retrieve the raw pkgdown external dependencies cache for all supported pkgdown versions. For example:
Update offline build logic
Now the package contains the minified cache with deduplicated files
in inst/cache/
. Commit and push.
Certain internet-skipping logic in
pkgdown.offline::build_site()
and relevant functions might
need adjustments.
Using the bundled cache
When pkgdown.offline::init_site()
or
pkgdown.offline::build_site()
is called to initialize or
build site offline, the copy_to_cache()
function will use
restore_cache()
to restore the cache into their original
structure to the regular pkgdown cache location that individual pkgdown
versions expect.
You can run the manual tests under tests/manual/
to
verify if everything works. Note that the package should be in the
installed state for inst/cache/
to work.