Skip to main content
Version: 0.5

Template loaders

This page provides a reference for all the available template loaders that can be used to customize template retrieval in Marten.

FileSystem Loader

Class: Marten::Template::Loader::FileSystem

Loads templates directly from the file system.

Initialization example:

loader = Marten::Template::Loader::FileSystem.new("/path/to/templates")

AppDirs Loader

Class: Marten::Template::Loader::AppDirs

Coordinates template loading from application directories. Relies on instances of FileSystem.

Initialization example:

loader = Marten::Template::Loader::AppDirs.new

Cached Loader

Class: Marten::Template::Loader::Cached

Provides a caching layer for compiled templates. Can wrap other loaders to optimize retrieval.

Initialization example:

file_loader = Marten::Template::Loader::FileSystem.new("/path/to/templates")
loader = Marten::Template::Loader::Cached.new([file_loader] of Marten::Template::Loader::Base)