View Source Surface.View (surface v0.11.4)

Use this module on regular Phoenix views to enable .sface templates

Examples

To make sface templates available on all your views, add to the view function on lib/your_app_web.ex:

defmodule YourAppWeb do
  # ...

  def view do
    use Phoenix.View,
      root: "lib/your_app_web/templates",
      namespace: YourAppWeb

    # ...

    use Surface.View, root: "lib/your_app_web/templates"
  end
end

If you want to make it available only on specific views, you can add a new function on the lib/your_app_web.ex:

defmodule YourAppWeb do
  # ...

  def surface_view(options \ []) do
    [
      view(options),
      quote do
        use Surface.View, root: "lib/your_app_web/templates"
      end
    ]
  end
end

Then, replace use YourAppWeb, :view with use YourAppWeb, :surface_view on the views you want to enable sface templates.

Summary

Functions

Returns the hash of all template paths for the given view. Used by Surface to check if a given view requires recompilation when a new template is added.

Functions

Returns the hash of all template paths for the given view. Used by Surface to check if a given view requires recompilation when a new template is added.