I asked this question in stackoverflow but didn’t see enough discussion. I have managed to work around the problem but still wondering if there is any better solution.
My package is hosted in github, and user can install it through devtools::install_github.
I’m using pkgdown to generate documentation site, which created a 10M docs folder. Then I found devtools::install_github always download the whole master zip ball which become quite slow.
I tried to exclude the docs folder with these attempts:
- .Rbuildignore, turned out it’s only about bundled package, while install_github is installing source package so it doesn’t work.
- put package one level lower than root folder.
root/pkg: package source
root/docs: package site
However the whole master zip ball is always downloaded, even with subdir = “pkg” specified.
- put full package source and generated site in a branch
package, and to exclude docs folder from the master branch. Developing in
packagebranch, update site, but keep site out of the
masterbranch. This means I need to merge two branch except docs folder. I tried make .gitignore to be branch specific but it doesn’t seem to work. This seemed to be impossible.
- My newest attempt is to create a separate repo solely for the website, just let pkgdown create the website in that folder like build_site(path = “…/docsite/docs”). This solved the problem and everything is simple. The only imperfection is the website url will not be the usually pattern.
EDIT: made some edits to clarify.