Define an HTML dependency
htmlDependency(name, version, src, meta = NULL, script = NULL, stylesheet = NULL, head = NULL, attachment = NULL, package = NULL, all_files = TRUE)
- Library name
- Library version
- Unnamed single-element character vector indicating the full path of the library directory. Alternatively, a named character string with one or more elements, indicating different places to find the library; see Details.
- Named list of meta tags to insert into document head
- Script(s) to include within the document head (should be
specified relative to the
- Stylesheet(s) to include within the document (should be
specified relative to the
- Arbitrary lines of HTML to insert into the document head
- Attachment(s) to include within the document head. See Details.
- An R package name to indicate where to find the
srcis a relative path (see
- Whether all files under the
srcdirectory are dependency files. If
FALSE, only the files specified in
attachmentare treated as dependency files.
Each dependency can be located on the filesystem, at a relative or
absolute URL, or both. The location types are indicated using the names of
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
<link id="DEPNAME-ATTACHINDEX-attachment" rel="attachment"
href="..."> is inserted, where
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
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
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
htmlDependency at build-time, it should be called at
run-time. This can be done by wrapping the
htmlDependency call in a
An object that can be included in a list of dependencies passed to
attachDependencies to associate a list of
dependencies with the HTML it belongs with.