     grunt.log.writeln("Mounting application at path '#{relativeUrlRoot}'.")
     _(express()).tap (otherApp) ->
       otherApp.use(relativeUrlRoot, app)
+
+  configureLiveReloadMiddleware = (app) ->
+    return unless livereload = grunt.config.get("livereload")
+    return if livereload.injectScript == false
+    port = livereload.port || 35729
+    grunt.log.writeln("Injecting LiveReload script into HTML documents (port: #{port})")
+    app.use(require('connect-livereload')({port}))
 
   mountUserStaticRoutes = (app, webRoot, staticRoutes) ->
     _(staticRoutes).each (src, dest) ->


    app.configure ->
      app.use(express.compress())

      if liveReloadEnabled
        grunt.log.writeln("Connected LiveReload middleware on port: #{liveReloadPort}")
        app.use(require('connect-livereload')(
          port: liveReloadPort
        ))

      app.use(express.static("#{process.cwd()}/#{webRoot}"))
      mountUserStaticRoutes(app, webRoot, staticRoutes)


    apiProxyPrefix  = grunt.config.get("server.apiProxy.prefix") || undefined
    apiProxyHost = grunt.config.get("server.apiProxy.host") || "localhost"
    apiProxyChangeOrigin = grunt.config.get("server.apiProxy.changeOrigin") || true
    webPort = process.env.WEB_PORT || grunt.config.get("server.web.port") || 8000
    webRoot = grunt.config.get("server.base") || "generated"
    staticRoutes = grunt.config.get("server.staticRoutes")
