     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

  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)


  """
  def compile(files, root) when is_list(files) do
    files
    |> Enum.map(&(compile(&1, root, pre_compile_templates)))
  end
  def compile(file, root, _pre_compile = false) when is_binary(file) do
    file_match = Path.relative_to(file, root)
    quote do
      def render_template(unquote(file_match), assigns) do
        EEx.eval_file(unquote(file), assigns: assigns)
      end
    end
  end
  def compile(file, root, _pre_compile = true) when is_binary(file) do
    file_match = Path.relative_to(file, root)
    quoted = EEx.compile_file(file)
    quote do
      def render_template(unquote(file_match), var!(assigns)) do
        unquote(quoted)
