Closed seanbirchall closed 4 months ago
This is what we did on a recent project for css/js resources:
ui <- bslib::page_navbar(
useShinyjs(),
tags$head(
tags$style(id = "myproject_css", HTML(paste(readLines("www/css/style.css", warn = F), collapse = "\n"))),
tags$script(id = "myproject_js", HTML(paste(readLines("www/js/script.js", warn = F), collapse = "\n")))
),
...
This adds an id-named
I have a previous app that had no issue loading css / js dependencies using the below (app). I've noticed recently that this appears to no longer work. If I clone the above and run
httpuv::runStaticServer("site")
which is within apps\ide\site the app launches and doesn't show much out of the ordinary in the console for errors besides the below. However the app launches as a blank screen.EDIT: The issue also exists with shiny modules too.
App folder structure of previously working app
Previously working code
If I try different ways to include css / js I get different errors. For
includeScript
/includeCSS
the shinylive app fails as it cannot find the files. Fortags$script
/tags$link
the app launches but also cannot find the files mounted on localhost/style.css ... etc.Smaller reprex app trying various ways to include css / js (same folder structure).
I can however include css / js from a remote URL like below. After messing with it for quite a bit I thought it'd be something related to my browser cache or an outdated version of shinylive, but it looks like this could be an new unintended bug.
I probably need to get my R package version updated to 0.1.1.9000 and web assets to 0.3.0