Solid.FileSystem behaviour (solid v1.0.0)
View SourceA file system is a way to let your templates retrieve other templates for use with the include tag.
You can implement a module that retrieve templates from the database, from the file system using a different path structure, you can provide them as hard-coded inline strings, or any manner that you see fit.
You can add additional instance variables, arguments, or methods as needed.
Example:
file_system = Solid.LocalFileSystem.new(template_path)
text = Solid.render(template, file_system: {Solid.LocalFileSystem, file_system})
This will render the template with a LocalFileSystem implementation rooted at 'template_path'.
Summary
Callbacks
@callback read_template_file(binary(), options :: any()) :: {:ok, String.t()} | {:error, Exception.t()}