             if map? 
               mapFile = jsPath.replace /\.js$/, '.map'
               mapPath = pathname.replace /\.js$/, '.map'
-
               # Special comment at the end that is required to signify to WebKit dev tools
               # that a source map is available:
               mapHeader = "//@ sourceMappingURL=#{mapPath}\n"
               js = "#{mapHeader}\n#{js}"
-
             fs.writeFile jsPath, js, 'utf8', ->
               return next() unless map?
               fs.writeFile mapFile, map, 'utf8', next
-
       # Force compilation
       return compile() if options.force
-
       # Compare mtimes
       fs.stat coffeePath, (err, coffeeStats) ->
         return error err if err

###

module.exports = (options = {}) ->

  # Accept src/dest dir
  if typeof options is 'string'
    options = src: options

  # Base directory
  baseDir = options.baseDir or process.cwd()

  # Source dir required
  src = options.src
  throw new Error 'Coffeescript middleware requires "src" directory' unless src
  src = path.resolve baseDir, src

  # Default dest dir to source
  dest = if options.dest then options.dest else src
  dest = path.resolve baseDir, dest

  # Default compile callback
  options.compile ?= (str, options) ->
    coffeeScript.compile str, clone(options)

  # Middleware
  (req, res, next) ->
    return next() if 'GET' isnt req.method and 'HEAD' isnt req.method

        pathname = pathname.substring options.prefix.length
      jsPath = path.join dest, pathname
      coffeePath = path.join src, pathname.replace '.js', '.coffee'
      # Ignore ENOENT to fall through as 404
      error = (err) ->
        arg = if 'ENOENT' is err.code then null else err
        next arg
      # Compile to jsPath
      compile = ->
        debug 'read %s', jsPath
