I’m busy preparing slides for the Why R? conference using the brilliant {xaringan}
package along with {xaringanthemer}
to tweak the styles. There are plots rendered into the document as well as static images.
I wanted to publish the presentation using GitLab Pages. My first attempt left me with no styles or images, but after a few iterations I had something that works.
This is the contents of my .gitlab-ci.yml
file:
image: rocker/verse:4.0.0
before_script:
- R -e "install.packages('xaringanthemer')"
pages:
stage: deploy
script:
- Rscript -e "rmarkdown::render('talk.Rmd', output_file = 'index.html')"
- mkdir public
- cp index.html xaringan-themer.css public/
- cp -r index_files/ fig/ public/
artifacts:
paths:
- public
only:
- master
interruptible: true
GitLab Pages expects the content to be found in the public/
folder. To ensure that the paths to images (static and rendered) are correct, I render the Rmd
in the current folder and then copy everything across into public/
.
Hopefully this will save you the 30 minutes it took me to figure this all out.