Skip to content

Instantly share code, notes, and snippets.

@schrockwell
Last active August 19, 2019 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schrockwell/1237b7cf60ae88a12174e0d25d2ed279 to your computer and use it in GitHub Desktop.
Save schrockwell/1237b7cf60ae88a12174e0d25d2ed279 to your computer and use it in GitHub Desktop.
defmodule MyAppWeb do
# Locate views at "lib/my_app_web/[controller]/templates/[view].html.eex
def view do
quote location: :keep do
use Phoenix.View,
root:
"lib/my_app/#{
Regex.replace(
~r/View$/,
__MODULE__ |> Module.split() |> Enum.slice(1..-1) |> Enum.join("."),
""
)
|> Macro.underscore()
}/templates",
path: "",
namespace: MyAppWeb
# ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment