Solid.Sigil (solid v1.1.1)
View SourceProvides the ~LIQUID sigil for validating and compiling Liquid templates using Solid.
This sigil validates the template at compile time and returns a compiled Solid template. If the template has syntax errors, it will raise a CompileError with detailed information.
Examples
iex> import Solid.Sigil
iex> template = ~LIQUID"""
...> Hello, {{ name }}!
...> """
iex> Solid.render(template, %{"name" => "World"})
{:ok, "Hello, World!"}An optional module attribute @liquid_tags can set which tags will be used while parsing.
defmodule MyModule do
import Solid.Sigil
@liquid_tags Solid.Tag.default_tags() |> Map.put("current_line", CustomTags.CurrentLine)
def template do
~LIQUID"{% current_line %}"
end
end