How can I include a external css of a shiny app into the flexdashboard. I have tried putting css file in the YAML header but that didn't work
The style.css is inside www directory
style.css
```
p{
font-size:100px
}
```
dashboard.rmd
```
---
title: 'Dashboard Like a Boss'
output:
flexdashboard::flex_dashboard:
vertical_layout: scroll
orientation: rows
runtime: shiny
css: style.css
---
```{r}
ui <- fluidPage(
tags$head(tags$link(rel = "stylesheet", href = "style.css")),
tags$p("Hello, world!")
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
```
In the dashboard, the styling doesn't work, but when the shiny app is run in a separate file (e.g., app.R), the styling works.
Output of flexdasboard:
Output of app.R
I have found a way to use styling for the Shiny App inside flexdashboard. By defining a variable (css in this case) and using tags$style(HTML(css)) within the UI section, you can apply custom styles to the elements in your Shiny App
css <- '
p{
font-size:100px;
}
'
ui <- fluidPage(
tags$head(tags$style(HTML(css))),
tags$p("Hello, world!")
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
Now when I run the document the the flexdashboard display with the style. Even though this won't be the best approach but works for now. Other answers are also welcome