I've got a Bookdown book for which I'd like to build a GitBook site as well as PDF and EPUB downloads. I will use Travis to build all 3 outputs, and the PDF and EPUB will be available for download from the GitBook site.
The bookdown-demo
calls bookdown::render_book
once for each output in _build.sh.
However, according to the logs in RStudio, the Build Book
button, when building All Formats
, uses rmarkdown::render_site(encoding = 'UTF-8')
to build all outputs in a single command.
I'd like to ensure what happens on my CI server is exactly what happens in my IDE, so it seems like I should have Travis call rmarkdown::render_site
rather than several invocations of bookdown::render_book
as is done by the bookdown-demo
. However, Yihui is the expert, and he has chosen to use the latter approach.
So, my question: what is the best script to invoke on a continuous integration server like Travis when multiple outputs will be built?
In bookdown projects, they usually don't make a difference, because rmarkdown::render_site()
eventually calls bookdown::render_book()
to render your book. Feel free to use either way.
The only exception is when your index.Rmd
does not contain the field site: bookdown::bookdown_site
. In that case, rmarkdown::render_site()
won't work, because it doesn't know this is supposed to be a bookdown project.
BTW, to render all output formats with bookdown::render_book()
, you can use the argument output_format = 'all'
.