Is there a way to parameterize my R code to pull in the $navbar-bg option from a custom.scss file? #3263
-
So I have a file called custom.scss where I have set some colors for the theme of a website. The contents are this:
I have a file that has an R code block in it. I would like to use the $navbar-bg color for this code. I know that I could write the yaml for the file to specify a parameters and then access that in my code. I am not sure how to access particular objects in that custom.scss file. So what I currently have is this:
But that obviously doesn't work. What would I do to just automatically specify that parameter based on the contents of my custom.scss file? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I found a way for R using an ---
title: Title
format:
html:
css: style.scss
---
```{r}
readLines(rmarkdown::metadata[["format"]][["html"]][["css"]])
``` Original post: I drop my idea here, but there is something I quite not understand yet. ---
title: Title
format:
html:
css: style.scss
params:
style-file: "{{< meta format.html.css >}}"
---
Test {{< meta format.html.css >}}
```{r}
params[["style-file"]] == "style.scss"
print(params[["style-file"]])
print("style.scss")
```
EDIT: Funny, when testing |
Beta Was this translation helpful? Give feedback.
I found a way for R using an
rmarkdown
"trick".Although, I wonder if something more general than the
rmarkdown::metadata
list trick is possible in Quarto, but I think it's a feature that could be very handy.Original post:
I drop my idea here, but there is something I quite not understand yet.
EDIT: Funny, when tes…