Add dependencies for some server end functions. For most UI functions, the dependency has been automatically attached for you when you call the function. Most server functions will also attach the dependency for you automatically too. However, a few server functions have to append the dependency before app start like addLoader. So you would need to call in this function somewhere in your UI. Read help of each function for details.

spsDepend(dep = "", js = TRUE, css = TRUE, listing = TRUE)

Arguments

dep

dependency names, see details

js

bool, use only javascript from this resource if there are both js and css files?

css

bool, use only CSS from this resource if there are both js and css files?

listing

bool, if your dep is invalid, list all options? FALSE will mute it.

Details

For dep, current options are:

  • basic: spsComps basic css and js

  • update_pg: spsComps pgPaneUpdate function required, js and css

  • update_timeline: spsComps spsTimeline function required, js only

  • font-awesome: font-awesome, css only

  • toastr: comes from shinytoastr package, toastr.js, css and js

  • pop-tip: enable enhanced bootstrap popover and tips, required for bsHoverPopover function. js only

  • gotop: required by spsGoTop function. js and css

  • animation: required for animation related functions to add animations for icons and other elements, like animateServer. js and css

  • css-loader: required for loader functions, like addLoader. js and css

  • sweetalert2: sweetalert2.js, required by shinyCheckPkg, js only

Examples

# list all options
spsDepend("")
#> Warning: 
[WARNING] 2023-10-07 07:25:51.736915 Dependency "" not found.
#> - basic: spsComps basic css and js
#> - css_loading: for css loaders
#> - update_pg: spsComps [pgPaneUpdate] function required, js and css
#> - update_timeline: spsComps [spsTimeline] function required, js only
#> - font-awesome: font-awesome, css only
#> - toastr: comes from shinytoastr package, toastr.js, css and js
#> - pop-tip: enable enhanced bootstrap popover and tips, required for [bsHoverPopover] function
#> - gotop: required by [spsGoTop] function
#> - animation:  required for animation related functions to add animations
#> for icons and other elements
#> - css-loader: required for loader functions
#> - sweetalert2: for shinyCheckPkg function
# try some options
spsDepend("basic")
#> [[1]]
#> List of 10
#>  $ name      : chr "spsComps-js"
#>  $ version   : chr "0.3.3.99"
#>  $ src       :List of 2
#>   ..$ href: chr "spsComps"
#>   ..$ file: chr "assets"
#>  $ meta      : NULL
#>  $ script    : chr "js/sps-comps.js"
#>  $ stylesheet: NULL
#>  $ head      : NULL
#>  $ attachment: NULL
#>  $ package   : chr "spsComps"
#>  $ all_files : logi FALSE
#>  - attr(*, "class")= chr "html_dependency"
#> 
#> [[2]]
#> List of 10
#>  $ name      : chr "spsComps-css"
#>  $ version   : chr "0.3.3.99"
#>  $ src       :List of 2
#>   ..$ href: chr "spsComps"
#>   ..$ file: chr "assets"
#>  $ meta      : NULL
#>  $ script    : NULL
#>  $ stylesheet: chr "css/sps-comps.css"
#>  $ head      : NULL
#>  $ attachment: NULL
#>  $ package   : chr "spsComps"
#>  $ all_files : logi FALSE
#>  - attr(*, "class")= chr "html_dependency"
#> 
spsDepend("font-awesome")
#> [[1]]
#> List of 10
#>  $ name      : chr "font-awesome"
#>  $ version   : chr "6.4.2"
#>  $ src       :List of 1
#>   ..$ file: chr "fontawesome"
#>  $ meta      : NULL
#>  $ script    : NULL
#>  $ stylesheet: chr [1:2] "css/all.min.css" "css/v4-shims.min.css"
#>  $ head      : NULL
#>  $ attachment: NULL
#>  $ package   : chr "fontawesome"
#>  $ all_files : logi TRUE
#>  - attr(*, "class")= chr "html_dependency"
#> 
# Then add it to your shiny app
if(interactive()){
    library(shiny)

    ui <- fluidPage(
      tags$i(class = "fa fa-house"),
      spsDepend("font-awesome")
    )

    server <- function(input, output, session) {

    }

    shinyApp(ui, server)
}