Hi all,
I am terying quarto as a replacement for my Rmd-based rmarkdown::render workflow to render reports into specific folders. The usual project structure has the Rmd files in a scripts folder and then I render them to specific results folders :
I've had the same problem specifying the output-dir: option in the _quarto.yml file. Keeping code in separate folder is important so that I can ensure only code gets uploaded to github, whereas outputs get ignored. It's inconvenient to add a *_files/ to my .gitignore as opposed to my output/ covering everything in the output folder.
@Rory_OG I totally get it. That is also a reason why I keep most of my reports away form the scripts.
I had a tip on twitter that --output-dir would work inside a "Quarto project". So I created the project with quarto create and then rendered my script with quarto render scripts/hello.qmd --output-dir results. It sort of works, but the output is sent to "results/scripts/".
So my conclusion is that for now I will stick to rmarkdown::render and tell my pythonista colleagues to use quarto for simpler use cases and testing, but not for production yet.
I spent a lot of tome yesterday and today researching different approaches. I ultimately opted to keep the reports in the root directory and use a combination of:
to get the html and the supporting files moved into the output folder. For some reason, output-dir hasn’t been moving the supporting files so I found the shell command as a work around.
This is an interesting discussion. Could you open a discussion about this in Quarto repo directly ?
--output-dir is indeed working differently than in rmarkdown::render(). It will work for Project only, and is used to change the default output folder.
This is expected as your Qmd document is in a scripts subfolder, the results will also be in a same name subfolder as it would be expecting for Quarto project like websites or books. This is how it works.
@adomingues t seems you have another use case to change where the output of a single document are stored. Currently, I don't think there is a flag for that in quarto render. This would be worth discussing for a feature request. For now, using post-render script as shared by @Rory_OG would be the way .
Sure thing, I’ll add it in. I created an issue for this a couple weeks ago and was told this is the expected behavior and that it’s quite complicated to deal with .qmd files being stored in subdirectories without the output dir also containing that subdirectory in the new path.
Hopefully this technique and some .gitignore safeguards will be a solid workaround for the time being.