     end
   end
 
+  def verified_routes do
+    quote do
+      use Phoenix.VerifiedRoutes,
+        endpoint: <%= @endpoint_module %>,
+        router: <%= @web_namespace %>.Router,
+        statics: <%= @web_namespace %>.static_paths()
+    end
+  end
+
   defp view_helpers do
     quote do<%= if @html do %>
       # Use all HTML functionality (forms, tags, etc)
       use Phoenix.HTML
-      use Phoenix.VerifiedRoutes,
-        endpoint: <%= @endpoint_module %>,
-        router: <%= @web_namespace %>.Router,
-        statics: <%= @web_namespace %>.static_paths()
 
       # Import LiveView and .heex helpers (live_render, <.link>, <.form>, etc)
       import Phoenix.LiveView.Helpers
-<% else %>
-      use Phoenix.VerifiedRoutes,
-        endpoint: <%= @endpoint_module %>,
-        router: <%= @web_namespace %>.Router,
-        statics: <%= @web_namespace %>.static_paths()
 <% end %>
       # Import basic rendering functionality (render, render_layout, etc)
       import Phoenix.View

      import <%= @web_namespace %>.ErrorHelpers<%= if @gettext do %>
      import <%= @web_namespace %>.Gettext<% end %><%= if @html do %>
      alias Phoenix.LiveView.JS<% end %>
    end
  end


  def controller do
    quote do
      use Phoenix.Controller, namespace: <%= @web_namespace %>

      import Plug.Conn<%= if @gettext do %>
      import <%= @web_namespace %>.Gettext<% end %>

      unquote(verified_routes())
    end
  end

