     @_render(str, opts)
 
   renderFile: (file, opts = {}) ->
-    @render(fs.readFileSync(file, 'utf8'), _.extend(opts, {filename: file}))
+    readFile(file).then _.partialRight(@render, _.extend(opts, {filename: file})).bind(@)
 
   compile: (str, opts = {}) ->
     if not @_compile

fs = require 'fs'
W = require 'when'
_ = require 'lodash'

class Adapter
  render: (str, opts = {}) ->

    @_compileClient(str, opts)

  compileFileClient: (file, opts = {}) ->
    readFile(file).then _.partialRight(@compileClient, _.extend(opts, {filename: file})).bind(@)

module.exports = Adapter
