-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Description
If an htmltools::htmlDependency() gets added to the UI of a regular shiny app, shiny knows how to treat it as a dependency and add the scripts/css files to the head.
If it gets added to a shiny-powered Rmarkdown, it gets converted to text.
Example:
The following shiny app adds the fontawesome dependencies, and therefore the icon shows up
library(shiny)
ui <- fluidPage(
fontawesome::fa_html_dependency(),
tags$i(class = "fas fa-pencil")
)
server <- function(input, output, session) {}
shinyApp(ui, server)The following Rmarkdown treats the dependency as text
---
runtime: shiny
---
```{r}
fontawesome::fa_html_dependency()
tags$i(class = "fas fa-pencil")
```The rmarkdown version does work if I wrap the dependency in an empty attachDependencies():
htmltools::attachDependencies(HTML(''), fontawesome::fa_html_dependency())This is technically not a bug because the documentation of htmlDependency() does say that these objects are meant to go inside attachDependencies(), but in practice because it works in regular shiny apps I would expect it to also work in Rmd.
Metadata
Metadata
Assignees
Labels
No labels