rstudio / flexdashboard

Easy interactive dashboards for R
https://pkgs.rstudio.com/flexdashboard/
Other
813 stars 300 forks source link

Cannot import custom css when using runtime shiny and a theme is defined in 0.6.0 #402

Closed koldLight closed 1 year ago

koldLight commented 2 years ago

Hi,

It looks flexdashboard 0.6.0 is not correctly reading the css external file when using runtime shiny and a bootswatch theme.

Same code works in 0.5.2 but fails in 0.6.0 with the following error:

Warning in file(con, "r") :
  cannot open file 'app.css': No such file or directory
Warning: Error in file: cannot open the connection
  143: file
  142: readLines
  141: xfun::read_utf8
  128: base
  127: output_format$pre_knit
  126: render
  125: discover_rmd_resources
  124: find_external_resources
  123: copy_render_intermediates
  122: output_format$intermediates_generator
  121: <Anonymous>
  116: <reactive>
  100: doc
   99: renderUI
   98: func
   85: renderFunc
   84: output$__reactivedoc__
    3: <Anonymous>
    1: rmarkdown::run

To reproduce this error, create a project with these two files:

app.Rmd

---
title: "Title"
runtime: shiny
output:
  flexdashboard::flex_dashboard:
    css: app.css
    theme:
      bootswatch: flatly
---

### Chart 1

app.css

.chart-wrapper {
  background-color: purple !important;
}

And compare 0.5.2 (ok) vs 0.6.0 (error)

LELULAS commented 1 year ago

Same issue. Chiming in to note that this problem appears confined to the CSS external file...YAML reference to logo and favicon that are located in the same "www" folder as my custom CSS work just fine. Had to revert back to version 0.5.2 to import custom CSS.

cpsievert commented 1 year ago

Turns out this problem is not unique to {flexdashboard}, and a fix will need to come from {rmarkdown}, so I'll be closing this issue thread.

I filed a more minimal reprex of the issue here https://github.com/rstudio/rmarkdown/issues/2443... please subscribe/follow that issue for progress updates.