I am attempting to convert a relatively complex shiny app (3-4 modules, 8 CSS/JS files) into a package with one external function that builds an instance of an app for a given input (build_myApp(dataset1, title, factors)
which is stored in build_myApp.R
within the R/
directory, along with myApp_server.R
, myApp_ui.R
and various helper files).
I have been following this example here and it all works well now except the styling has disappeared. Here, someone appears to have similar issues, however without trying to "functionize" their app.
Previously, I have put external files in a top-level www
folder, and called them from the top-level ui.R
file like this: tags$link(rel = "stylesheet", type = "text/css", href = "sample1.css")
or tags$script(src="www/sample.js")
. However I am currently unable to access any of them, and am possibly unable to access other external css, though hard to tell for sure.
I have tried leaving the www
header at top-level, putting it within an inst/
top-level folder, and moving it within R/
and restarted R session & rebuilt package each time. For completionists-sake, in all of those I have tried permutations of:
sample1.css
./sample2.css
../sample3.css
www/sample4.css
./www/sample5.css
../www/sample6.css
/www/sample7.css
inst/www/sample8.css
/inst/www/sample9.css
./inst/www/sample10.css
../inst/www/sample11.css
inst/sample12.css
/inst/sample13.css
./inst/sample14.css
../inst/sample15.css
Unfortunately the Mastering Shiny Chapter doesn't mention it and I can't find any other references online. Any advice would be much appreciated, thanks!