     window.run grunt.file.read options.paths.emblem, 'utf8'
     if options.paths.ember
       window.run grunt.file.read options.paths.ember, 'utf8'
-      emberEnabled = true
+      templateBuilder = new EmberBuilder(window, rootPath: options.root)
     else
-      emberEnabled = false
+      templateBuilder = new VanillaBuilder(window, rootPath: options.root)
 
 
     grunt.verbose.writeflags(options, 'Options')



  ########################################################
  # Vanilla Compilation -
  # Compiles the file at provided filepath and returns the output
  ########################################################
  compileVanilla = (src, window, key) ->
    content = window.Emblem.precompile window.Handlebars, src

    """
    var templates = Handlebars.templates = Handlebars.templates || {};
    templates['#{key}'] = Handlebars.template(#{content});
    """

  ########################################################
  # Ember Compilation
  ########################################################
  compileEmber = (src, window, key) ->
    key = JSON.stringify(key)
    compiled = window.Emblem.precompile(window.Ember.Handlebars, src)
    template = "Ember.Handlebars.template(#{compiled})"
    "Ember.TEMPLATES[#{key}] = #{template};"

  ########################################################
  # Key for given filepath
  ########################################################
  keyForFilePath = (filepath, root) ->
    key = filepath
      .replace(new RegExp('\\\\', 'g'), '/') #replace backslashes
      .replace(/\.\w+$/, '') #remove extension
      .replace(root, '')

  ########################################################
  # Filters out missing files
  ########################################################


      # iterate files, processing partials and templates separately
      f.src.filter(fileExists).forEach (filepath) ->
        src = grunt.file.read(filepath)

        try
          templates.push templateBuilder.build(src, filepath)
        catch e
          grunt.fail.warn e
          # Warn on and remove invalid source files (if nonull was set).
          grunt.fail.warn "Emblem failed to compile " + filepath + "."

      if templates.length < 1
        grunt.log.warn "
