add overwrite argument in `copyDependencyToDir` for Rmd `self_contained: false`

Open
#294 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
web-dev

Research direction

Start by locating the copyDependencyToDir implementation and reading how it currently handles existing HTML dependencies and its mustWork argument. Add the proposed optional overwrite_dir behavior while preserving the current default, then verify repeated renders with self_contained: false avoid unnecessary overwrites.

Written by the indexing model from the issue text.

Description

Hi all,

I recently posted an issue in https://github.com/rstudio/rmarkdown/issues/2226#issue-1012707759 related to rmarkdown's self_contained: false yaml option. This option uses htmltools::copyDependencyToDir for HTML dependencies and it works great!

However, the current behavior of copyDependencyToDir is to overwrite HTML dependencies, even if they already exist, which can be time-consuming if you are iteratively rendering many Rmd files, and/or editing Rmd files using this option.

I'm happy to submit a PR, but wanted to post here to see if there were any concerns with adding in something like:
overwrite_dir = TRUE

copyDependencyToDir(
  dependency,
  outputDir,
  mustWork = TRUE,
  overwrite_dir = TRUE
)
Dominant language
R
Stars
225
Forks
73
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rstudio/htmltools

All issues in rstudio/htmltools

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.