Short version: Is it possible to set Rstudio bookdown so that, when using html output, it doesn't rebuild unchanged Rmd files and instead uses the existing html files (kind of like make
)?
Long version:
I am using bookdown in RStudio to keep a project notebook. I create a separate Rmd file for each day, and have set new_session: yes
in _bookdown.yml
.
Ideally, the output should be "locked" at the end of the day, so that it accurately reflects that day's work, including that day's environment (which might be different from the current environment, as I update scripts and data). In particular, when I rebuild the book, I don't want the page from (say) a month ago to change (the one exception being if I add a deprecatory note about a subsequently-discovered error).
I can prevent the R code chunks from re-running by inserting knitr::opts_chunk$set(cache = TRUE)
into the first code chunk of each file. However, when I rebuild the book, each Rmd file is still converted to md and then to html, which is getting time consuming as my notebook grows! I realize that I don't need to rebuild the book to knit the current chapter, but periodic rebulding is desirable to keep the table of contents and search index up to date.
It would be great if there were a way for the rebuild to just re-use the existing html files for chapters that hadn't been changed. I realize that a potential challenge with this (and why there probably isn't a simple solution using make
) is keeping track of what to include in the toc of index.html
, as well as updating search_index.json
appropriately. Actually, now that I inspect the html files for the individual chapters, I see that the toc is coded into each one of them. So any solution would need a different architecture where the toc lived in a separate file.
Anyhow, just thought I'd see if there were either a hidden option or a workaround out there!