Reputation: 2773
I have many R Markdown/xaringan based slide decks that are using the same css files. Each lecture has an assets folder and things are working but the redundancy is driving me nuts. The file structure looks like this:
├── 01_introduction
│ └── lectures
│ ├── 01_Introduction.Rmd
│ ├── assets
│ │ ├── cssninja-scaffold.css
│ │ ├── macros.js
│ │ ├── ninjutsu.css
│ │ └── sydney.css
│ ├── images
│ └── libs
├── 02_rmarkdown
│ └── lectures
│ ├── 02_RMarkdown.Rmd
│ ├── assets
│ │ ├── cssninja-scaffold.css
│ │ ├── macros.js
│ │ ├── ninjutsu.css
│ │ └── sydney.css
│ ├── images
│ └── libs
└── slides_BST623_2023.Rproj
My current header is:
---
title: "Introduction"
author: "me"
date: "`r format(Sys.time(), '%b %d, %Y')`"
output:
xaringan::moon_reader:
css: ["default", "assets/sydney.css", "assets/cssninja-scaffold.css", "assets/ninjutsu.css"]
lib_dir: libs
---
I would like to use this file structure but I can't figure out the syntax for setting the path to the assets folder:
├── 01_introduction
│ └── lectures
│ ├── 01_Introduction.Rmd
│ ├── images
│ └── libs
├── 02_rmarkdown
│ └── lectures
│ ├── 02_RMarkdown.Rmd
│ ├── images
│ └── libs
├── assets
│ ├── cssninja-scaffold.css
│ ├── macros.js
│ ├── ninjutsu.css
│ └── sydney.css
└── slides_BST623_2023.Rproj
I found a couple issues that deal with this task: https://github.com/yihui/xaringan/issues/331 and https://github.com/yihui/xaringan/issues/29 but I still can't figure out the syntax.
How can I specify that the location of the ccs files is ../../ relative to the file's directory or specify it is ./assets relative to the project's directory (instead of the file's directory)?
Upvotes: 0
Views: 84