     readSync: (filename) ->
         fs.readFileSync(filename)?.toString()
 
-    write: (dest, data, done) ->
+    write: (path, dest, data, done) ->
         unless dest?
             return done null
         # save json dom in an own file

            # the next time a linked template is invoked it will use
            # automagicly the new data because elem doesn't change.
            elem.data = @compile opts.select?.call this
            @write(opts.dest, elem.data, done)

        # do an auto load if not loaded so an extra load call is not needed
        @load opts.src, reload  if opts.src? and not (@loading or @loaded)

        unless @extensions[ext]?
            return done new Error "file extension of #{dest} not supported."
        source = @extensions[ext](data)
        fullpath = pathjoin(path, dest)
        mkdirp dirname(fullpath), (err) ->
            return done err if err
            fs.writeFile(fullpath, source, done)

    parse: (data) ->
        @el = @$(data)
