htmlDependency(name, version, src, meta = NULL, script = NULL, stylesheet = NULL, head = NULL, attachment = NULL, all_files = TRUE)
src
parameter).src
parameter).src
directory are
dependency files. If FALSE
, only the files specified in
script
, stylesheet
, and attachment
are treated as
dependency files.attachDependencies
.
src
character vector: file
for filesystem directory,
href
for URL. For example, a dependency that was both on disk and at
a URL might use src = c(file=filepath, href=url)
. attachment
can be used to make the indicated files available to the
JavaScript on the page via URL. For each element of attachment
, an
element is inserted, where
DEPNAME
is name
. The value of
ATTACHINDEX
depends on whether attachment
is named or not; if
so, then it's the name of the element, and if not, it's the 1-based index
of the element. JavaScript can retrieve the URL using something like
document.getElementById(depname + "-" + index + "-attachment").href
.
Note that depending on the rendering context, the runtime value of the href
may be an absolute, relative, or data URI.
htmlDependency
should not be called from the top-level of a package
namespace with absolute paths (or with paths generated by
system.file()
) and have the result stored in a variable. This is
because, when a binary package is built, R will run htmlDependency
and store the path from the building machine's in the package. This path is
likely to differ from the correct path on a machine that downloads and
installs the binary package. If there are any absolute paths, instead of
calling htmlDependency
at build-time, it should be called at
run-time. This can be done by wrapping the htmlDependency
call in a
function.
attachDependencies
to associate a list of
dependencies with the HTML it belongs with.