Current section

Files

Jump to
phoenix_slime lib phoenix_slime engine.ex
Raw

lib/phoenix_slime/engine.ex

defmodule PhoenixSlime.Engine do
@behaviour Phoenix.Template.Engine
@doc """
Precompiles the String file_path into a function definition
"""
def compile(path, _name) do
path
|> read!
|> EEx.compile_string(engine: Phoenix.HTML.Engine, file: path, line: 1)
end
defp read!(file_path) do
file_path
|> File.read!()
|> Slime.Renderer.precompile()
end
end