Skip to contents

Loaders are responsible for exposing templates to the templating engine.

path_loader() loads templates from a directory in the file system.

package_loader() loads templates from a directory in an R package.

list_loader() loads templates from a named list.

Usage

path_loader(...)

package_loader(package, ...)

list_loader(x)

Arguments

...

Strings specifying path components.

package

Name of the package in which to search.

x

Named list mapping template names to template sources.

Value

A "jinjar_loader" object.

See also

The loader is an argument to jinjar_config().

Examples

path_loader(getwd())
#> Loader: /home/runner/work/jinjar/jinjar/docs/reference

package_loader("base", "demo")
#> Loader: {base}/demo

list_loader(list(
  header = "Title: {{ title }}",
  content = "Hello {{ person }}!"
))
#> Loader: "header" and "content"