djnavarro,

Today, thanks to a random github comment by @grrrck, I discovered that has pre-render and post-render options that allow you to execute custom scripts before and after rendering a project. Just add something like this to the _quarto.yml file and... it works 🎉

project:  
 type: website  
 post-render: ./post-render.sh  

I'm way too excited by this, aren't I? Yeah, even I can see that

MickaelCanouil,
@MickaelCanouil@fosstodon.org avatar

@djnavarro I am using a pre-render script to format a bib file into something I can use for custom listing in my website. 😎

You can use post-render to move your whole rendered projects elsewhere for example.

@grrrck

grrrck,
@grrrck@fosstodon.org avatar

@djnavarro ahh very glad to hear my random comment was helpful!

zeileis,
@zeileis@fosstodon.org avatar

@grrrck @djnavarro Just what I needed for my book project, thanks for sharing this!

Is it possible to specify in the .yml to only post-render the "html" target?

At the moment I need to catch the "pdf" and "epub" targets in the shell script because only the "html" needs improvements.

MickaelCanouil,
@MickaelCanouil@fosstodon.org avatar

@zeileis in post-render you can access the environment variable “QUARTO_PROJECT_OUTPUT_FILES”.
You can use it to write conditional post-render script(s) using TypeScript, LUA, bash, R, and Python.

https://quarto.org/docs/projects/scripts.html

@grrrck @djnavarro

zeileis,
@zeileis@fosstodon.org avatar

@MickaelCanouil That's really handy, thanks for the link. Based on this I could also simplify the script itself.

@grrrck @djnavarro

gvwilson,
@gvwilson@mastodon.social avatar

@djnavarro I… I thought you'd… I mean, it's no big deal, right, but I thought you'd use a Makefile for this (he said, trying hard not to sound just a little bit deflated in the way one would after discovering that someone did not, in fact, fall head over heels in love with their favorite band).

djnavarro,

@gvwilson I mean, I probably should right?

(In 100% honesty the main reason I haven't started using Make for this is that I haven't quite worked out the best way to build a site using the quarto CLI tool instead of pushing the magic buttons in RStudio 😬 ... which, now that I say it out loud... yeah, I should really get my act together and wrap my head around that)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • ethstaker
  • DreamBathrooms
  • cubers
  • mdbf
  • everett
  • magazineikmin
  • Durango
  • Youngstown
  • rosin
  • slotface
  • modclub
  • kavyap
  • GTA5RPClips
  • ngwrru68w68
  • JUstTest
  • thenastyranch
  • cisconetworking
  • khanakhh
  • osvaldo12
  • InstantRegret
  • Leos
  • tester
  • tacticalgear
  • normalnudes
  • provamag3
  • anitta
  • megavids
  • lostlight
  • All magazines