Tuesday 6 December 2016

R linking static files to multiple apps with shiny-server

How can I link some JavaScript or CSS to multiple shiny-apps using shiny-server?



Let's say I have some JS and CSS code in my /home/assets/ directory.



/home/assets/   
------jscode1.js
------jscode2.js
------style1.css
------style2.css



And I have several apps in /srv/shiny-server/:



/srv/shiny-server/  
------app1/
----------app.R
------app2/
----------app.R
------app3/
----------app.R



How can I include the javascript and css, without putting them in a www directory of every app.



I would like to use for example tags$head(tags$script(src = "/home/assets/jscode1.js")) in all of my apps.



I saw some recommendations (link1, link2) for addResourcePath() but they were mostly related to packages and I don't know what prefix to use.
Other options I thought about were includeScript/includeCSS/htmlDependency but they all say to use relative paths.



Additionally how can I include files from the shared directory?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...