 
     loadTemplateFile = (file, cb) =>
       fs.readFile file, (err, content) =>
+        return cb err if err
+
         file = path.normalize(file)
         index = file
           .replace(path.normalize(dirname), "")

          .replace(/\/(server|shared)\//, "")

        @metadata().templates[index] = content.toString()
        cb index

    finder = findit dirname

    # we received a file
    finder.on "file", (file, stat) =>
      files.push file

    # we received all files.
    finder.on "end", =>
      async.eachSeries files,
        readFile = (file, done) =>
          loadTemplateFile file, (index) =>
            done()

        # we are done!
        finished = (err) =>
          cb()

    # watch for changes and automatically reload files
    if Salad.env is "development"
      gaze "#{dirname}/*/*/*.hbs", (err, watcher) =>
        watcher.on "changed", (file) =>
          loadTemplateFile file, (index) =>
            content = @metadata().templates[index]
            Salad.Template.Handlebars.registerPartial index, content



    cb()

  initTemplates: (callback) ->
    # find all templates and save their content in a hash
    files = []
    @metadata().templates = {}
