 connect = require("connect")
 liveReload = require("connect-livereload")
 tiny_lr = require("tiny-lr")
-lr = undefined
 apps = []
 
 http2 = undefined

        if @livereload
          tiny_lr.Server::error = ->
          if @https
            lr = tiny_lr
              key: @https.key || fs.readFileSync __dirname + '/certs/server.key'
              cert: @https.cert || fs.readFileSync __dirname + '/certs/server.crt'
          else
            lr = tiny_lr()

          lr.listen @livereload.port
          @log "LiveReload started on port #{@livereload.port}"

  handlers: ->

  reload: ->
    es.map (file, callback) ->
      apps.forEach (app) =>
        if app.livereload and typeof app.lr == "object"
          app.lr.changed body:
            files: file.path
      callback null, file
  serverClose: ->
    apps.forEach((app) -> do app.server.close)
    apps = []
