Using htmlDependency()
Main parameters:
- A name.
- A version (useful to remember on which version it is built upon).
- A path to the dependency (can be a CDN or a local folder).
- script and stylesheet to respectively pass css and scripts.
# handle dependency
mdb_cdn <- "https://cdnjs.cloudflare.com/ajax/libs/"
mdb_card_dep <- function() {
htmlDependency(
name = "mdb-card",
version = "1.0",
src = c(href = mdb_cdn),
stylesheet = "mdb-ui-kit/3.6.0/mdb.min.css"
)
}
It is crucial to wrap the created dependency in a function since the path has to be determined at run time and not when the package builds.