View Source Liquex.LocalFileSystem (liquex v0.13.0)

This implements an abstract file system which retrieves template files named in a manner similar to liquid, ie. with the template name prefixed with an underscore. The extension ".liquid" is also added.

For security reasons, template paths are only allowed to contain letters, numbers, and underscore.

Example:

iex> file_system = Liquex.LocalFileSystem.new("/some/path") iex> Liquex.LocalFileSystem.full_path(file_system, "mypartial") "/some/path/_mypartial.liquid"

Optionally in the second argument you can specify a custom pattern for template filenames. %s is replaced with the template name. Default pattern is "_%s.liquid".

Example:

iex> file_system = Liquex.LocalFileSystem.new("/some/path", "%s.html") iex> Liquex.LocalFileSystem.full_path(file_system, "mypartial") "/some/path/mypartial.html"

Summary

Types

@type t() :: %Liquex.LocalFileSystem{pattern: String.t(), root_path: String.t()}

Functions

Link to this function

full_path(local_file_system, template_path)

View Source
@spec full_path(t(), String.t()) :: String.t()
Link to this function

new(root_path, pattern \\ "_%s.liquid")

View Source
@spec new(String.t(), String.t()) :: t()