This function can be used as the engine for a templating function in other
packages. The template
argument is used along with the package
argument
to derive the path to your template file; it will be expected at
fs::path_package(package = package, "templates", template)
. We use
fs::path_package()
instead of base::system.file()
so that path
construction works even in a development workflow, e.g., works with
devtools::load_all()
or pkgload::load_all()
. Note this describes the
behaviour of fs::path_package()
in fs v1.2.7.9001 and higher.
To interpolate your data into the template, supply a list using
the data
argument. Internally, this function uses
whisker::whisker.render()
to combine your template file with your data.