anchor.diff:              Opts = mad_utils:get_value(erl_opts, Conf1, []),
               lists:foreach(compile_fun(IncDir, EbinDir, Opts), Files),
               ok
  -    end.
  +    end,
  +    ErlyDtlOpts = mad_utils:get_value(erlydtl_opts, Conf1, []),
  +    ErlyDtlOpts1 = validate_erlydtl_opts(Dir, ErlyDtlOpts),
  +    compile_erlydtl_files(ErlyDtlOpts1),
  +    ok.
   
   -spec validate_property({atom(), term()}, term()) -> {atom(), term()}.
   validate_property({modules, _}, Modules) ->
  
positive.code:     fun(File) ->
              case is_app_src(File) of
                  false ->
                      Compiled = is_compiled(EbinDir, File),
                      if Compiled =:= false ->
                              io:format("Compiling ~s~n", [File]),
                              Opts1 = ?COMPILE_OPTS(IncDir, EbinDir, Opts),
  
negative.code:         _ ->
              false
      end.
  
  get_kv(K, Opts, Default) ->
      V = mad_utils:get_value(K, Opts, Default),
      KV = {K, V},
      {KV, Opts -- [KV]}.
  
  validate_erlydtl_opts(Cwd, Opts) ->
      DefaultDocRoot = filename:join("priv", "templates"),
      {DocRoot, Opts1} = get_kv(doc_root, Opts, DefaultDocRoot),
      {OutDir, Opts2} = get_kv(out_dir, Opts1, "ebin"),
      {CompilerOpts, Opts3} = get_kv(compiler_options, Opts2, []),
      {SourceExt, Opts4} = get_kv(source_ext, Opts3, ".dtl"),
      {ModuleExt, Opts5} = get_kv(module_ext, Opts4, ""),
  
      {_, DocRootDir} = DocRoot,
      DocRoot1 = {doc_root, filename:join(Cwd, DocRootDir)},
      {_, OutDir1} = OutDir,
      OutDir2 = {out_dir, filename:join(Cwd, OutDir1)},
  
      [DocRoot1, OutDir2, CompilerOpts, SourceExt, ModuleExt|Opts5].
  
  module_name(File, Ext, NewExt) ->
      list_to_atom(filename:basename(File, Ext) ++ NewExt).
  
  compile_erlydtl_files(Opts) ->
      {{_, DocRoot}, Opts1} = get_kv(doc_root, Opts, ""),
      {{_, SourceExt}, Opts2} = get_kv(source_ext, Opts1, ""),
      {{_, ModuleExt}, Opts3} = get_kv(module_ext, Opts2, ""),
      {{_, OutDir}, _} = get_kv(out_dir, Opts3, ""),
  
      Files = filelib:fold_files(DocRoot, SourceExt, true,
                                 fun(F, Acc) -> [F|Acc] end, []),
  
      Compile = fun(F) ->
                        ModuleName = module_name(F, SourceExt, ModuleExt),
                        BeamFile = erl_to_beam(OutDir, atom_to_list(ModuleName)),
                        Compiled = is_compiled(BeamFile, F),
                        if Compiled =:= false ->
                                io:format("Compiling ~s~n", [F]),
                                erlydtl:compile(F, ModuleName, Opts3);
                           true ->
                                ok
                        end
                end,
      lists:foreach(Compile, Files).
  