       Returns the template root alongside all template filenames.
       """
       def __templates__ do
-        {unquote(template_root), unquote(template_files)}
+        {@template_root, unquote(template_files)}
       end
 
       unquote(templates)
+
+      @doc """
+      Returns true whenever the list of templates changes in the filesystem.
+      """
+      def __template_recompile__? do
+        unquote(hash(template_root)) != Trot.Template.hash(@template_root)
+      end
     end
   end
 

  defmacro __using__(_opts) do
    quote do
      import Trot.Template
      @before_compile Trot.Template
    end
  end

  defmacro __before_compile__(env) do
    template_root = Module.get_attribute(env.module, :template_root) || "templates"
    template_files = Trot.Template.find_all(template_root)
    templates = Trot.Template.compile(template_files, template_root)


    Path.join(root, "**.eex")
    |> Path.wildcard
  end

  @doc """
  Returns the hash of all template paths in the given root.
  """
  @spec hash(String.t) :: binary
  def hash(root) do
    find_all(root)
    |> Enum.sort
    |> :erlang.md5
  end

  defp pre_compile_templates do
    Application.get_env(:mix, :env) != :dev
  end
end
