if (FALSE) {
# a direct call that would copy the file ~/webpage/v1/static/css/bootstrap.min.css
# to the project directory as /tmp/static/css/bootstrap.min.css
# and include "static/css/bootstrap.min.css" in the tag
my_HTML <- XMLNode(
"link",
rel="stylesheet",
type="text/css",
href=provide_file(
rel="static/css/bootstrap.min.css",
to="/tmp",
from="~/webpage/v1"
)
)
# for larger projects, a wrapper function might become handy
prov <- function(
rel,
to="/tmp",
from="~/webpage/v1",
overwrite=TRUE,
mode="0777"
){
provide_file(rel=rel, to=to, from=from, overwrite=overwrite, mode=mode)
}
# let's combine it with a shortcut function for
gen_tag_functions("link")
# now this code produces the same result as the direct call above
my_HTML2 <- link_(
rel="stylesheet",
type="text/css",
href=prov("static/css/bootstrap.min.css")
)
}
Run the code above in your browser using DataLab