defmodule SyntropyWeb do @moduledoc false def router do quote do use Phoenix.Router, helpers: false import Phoenix.Controller import Phoenix.LiveView.Router end end def controller do quote do use Phoenix.Controller, formats: [:html, :json], layouts: [html: SyntropyWeb.Layouts] import Plug.Conn unquote(verified_routes()) end end def live_view do quote do use Phoenix.LiveView, layout: {SyntropyWeb.Layouts, :app} unquote(html_helpers()) end end def html do quote do use Phoenix.Component unquote(html_helpers()) end end defp html_helpers do quote do import Phoenix.HTML import Phoenix.Component alias Phoenix.LiveView.JS unquote(verified_routes()) end end def verified_routes do quote do use Phoenix.VerifiedRoutes, endpoint: SyntropyWeb.Endpoint, router: SyntropyWeb.Router, statics: ~w() end end defmacro __using__(which) when is_atom(which) do apply(__MODULE__, which, []) end end