You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The resulting dependency functions of create_custom_dependency are not that convenient to work with if you want to add other HTML dependencies that are not in your package, like font awesome.
By allowing additional arguments, users can add dependencies (or other tags) to the tagList. The result of create_custom_dependency() could then look like this:
#' sportsswitch dependencies utils
#'
#' @description This function attaches sportsswitch dependencies to the given tag
#'
#' @param tag Element to attach the dependencies.
#' @param ... Additional arguments passed to \code{\link[htmltools]{tagList}}.
#'
#' @importFrom utils packageVersion
#' @importFrom htmltools tagList htmlDependency
#' @export
add_sportsswitch_deps <- function(tag, ...) {
sportsswitch_deps <- htmlDependency(
name = "sportsswitch",
version = "0.1.0",
src = c(file = "shinySportsKit-0.1.0"),
script = "dist/sportsswitch.min.js",
stylesheet = "dist/sportsswitch.min.css",
package = "shinySportsKit",
)
tagList(tag, sportsswitch_deps, ...)
}
This allows users to add another dependency like font awesome like so:
The resulting dependency functions of
create_custom_dependency
are not that convenient to work with if you want to add other HTML dependencies that are not in your package, like font awesome.By allowing additional arguments, users can add dependencies (or other tags) to the
tagList
. The result ofcreate_custom_dependency()
could then look like this:This allows users to add another dependency like font awesome like so:
This is mainly handy for component based bundling, where some components make use of dependency X, and others don't.
Currently the alternative is to use two or more
tagList
s, which is fine, but just a bit lengthy:The text was updated successfully, but these errors were encountered: