diff --git a/package.json b/package.json index ea5b44a..1f2fe3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-connect", - "version": "2.0.3", + "version": "2.0.4", "description": "Gulp plugin to run a webserver (with LiveReload)", "license": "MIT", "repository": { @@ -33,7 +33,7 @@ "event-stream": "~3.1.0", "connect-livereload": "~0.3.2", "tiny-lr": "0.0.5", - "connect": "~2.14.3" + "connect": "^2.14.3" }, "devDependencies": { "gulp": "~3.5.1", diff --git a/src/index.coffee b/src/index.coffee index 87341be..2073132 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -1,3 +1,4 @@ +path = require("path") es = require("event-stream") util = require("gulp-util") http = require("http") @@ -11,7 +12,7 @@ class ConnectApp constructor: (options) -> opt = options opt.port = opt.port || "8080" - opt.root = opt.root || __dirname + opt.root = opt.root || path.dirname(module.parent.id) opt.host = opt.host || "localhost" @oldMethod("open") if opt.open @server() @@ -38,6 +39,8 @@ class ConnectApp if typeof opt.root == "object" opt.root.forEach (path) -> middleware.push connect.static(path) + else + middleware.push connect.static(opt.root) return middleware log: (@text) ->