defmodule Server do
def live_view do
quote do
use Phoenix.LiveView,
layout: false
unquote(html_helpers())
end
end
defp html_helpers do
quote do
# HTML escaping functionality
import Phoenix.HTML
# Core UI components and translation
# import KinoLiveViewWeb.CoreComponents
# import KinoLiveViewWeb.Gettext
# Shortcut for generating JS commands
alias Phoenix.LiveView.JS
# Routes generation with the ~p sigil
unquote(verified_routes())
end
end
def verified_routes do
quote do
use Phoenix.VerifiedRoutes,
endpoint: Server.Endpoint,
router: Server.Router,
statics: []
end
end
defmacro __using__(which) when is_atom(which) do
apply(__MODULE__, which, [])
end
end