Last active
March 12, 2021 18:25
-
-
Save kleinlennart/e16c13d816b96c7d9eb077c31c979f95 to your computer and use it in GitHub Desktop.
Drake flavoured `render_site()` page build routine with static branching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# needs to be outside of the drake plan for `rmd_files = !!pages_paths` to work | |
pages_paths <- dir("reports", pattern = "*.Rmd", full.names = TRUE) | |
# TODO: exclude _file.Rmd with regex in dir | |
plan <- drake_plan( | |
render_pages = target( | |
# TODO: Add a trigger dependency on _site.yml | |
command = rmarkdown::render( | |
knitr_in(rmd_files), | |
output_dir = file_out("docs/"), | |
quiet = TRUE | |
), | |
transform = map(rmd_files = !!pages_paths) | |
# “bang-bang” operator !! from tidy evaluation | |
) | |
) | |
# not quite sure about the site_libs dir of render_site()... | |
# CSS, yml tags and assets work fine though | |
# Inspired by: https://rdrr.io/github/webbedfeet/coursedown/src/inst/templates/_drake.R |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@conradborchers See page wise render routine here