Including Js/css Scripts In Shiny App
I am building a Shiny application, but as it should get arguments for data for building plots, I decided to save my app as a function (using this tutorial: http://shiny.rstudio.com
Solution 1:
For anyone who may be having the same issue, I finally came up with the solution :-) There are 'include' functions in Shiny that let you specify a file with the absolute/relative path. Here is the reference: http://shiny.rstudio.com/reference/shiny/latest/include.html
And this is my example code:
app <- function(data)
{
shinyApp(
ui = fluidPage(
fluidRow(
# I created a 'www' folder that was included# in the package that is launching Shiny app
tags$head(includeScript(system.file('www', 'script.js', package = 'myPackage'))),
tags$head(includeCSS(system.file('www', 'style.css', package = 'myPackage'))),
# some UI stuff
)
),
server = function(input, output, session) {
# some server stuff
}
}
Post a Comment for "Including Js/css Scripts In Shiny App"