During development, I often prefer to create an explicit
shiny.appobj object via
shinyApp(). For example, rather than:
runApp(".") ## app directory-based execution
... I'll instead prefer:
app <- shinyApp(ui, server) ## ui and server are defined in my workspace runApp(app) ## app object-based execution
For additional app resources however, the latter approach doesn't seem to auto-map the
www subdirectory of my current working directory to the
. resource path in the app. So when I have a file
./www/foo.jpg and include in my UI something like:
ui <- fluidPage(tags$img(src = "foo.jpg")) ## runApp(".") <-- foo.jpg resolves ## runApp(app) <-- foo.jpg 404s
- foo.jpg resolves when I
runApp("."), i.e. run from the current working directory.
- foo.jpg 404s when I
runApp(app), i.e. the
wwwresource mapping didn't happen this time.
Does anyone know of the proper way to
runApp with a
shiny.appobj argument while also gaining (or specifying) a relative directory for resource path mappings?
(I should note why I prefer this pattern during development: the app has a startup preamble that loads a large dataset ... even when serialized as an RDS structure this takes an annoyingly long time to reload on each app iteration during development work.)