Liquex.LocalFileSystem (liquex v0.10.2) View Source

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"

Link to this section Summary

Link to this section Types

Specs

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

Link to this section Functions

Link to this function

full_path(local_file_system, template_path)

View Source

Specs

full_path(t(), String.t()) :: String.t()
Link to this function

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

View Source

Specs

new(String.t(), String.t()) :: t()