From f4ac4c595a479b44676824cdbdaa34cc1dc9d966 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Tue, 3 Feb 2015 12:25:24 +0000 Subject: [PATCH] fix(proxy): use path as startPath if given as proxy option --- lib/public/init.js | 12 ++++++++++++ lib/utils.js | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/public/init.js b/lib/public/init.js index c761b97ac..279a90711 100644 --- a/lib/public/init.js +++ b/lib/public/init.js @@ -22,13 +22,25 @@ module.exports = function (browserSync, name, pjson) { var config = merge(args.config) .withMutations(function (item) { + if (!item.get("server") && !item.get("proxy")) { item.set("open", false); } + item.set("version", pjson.version); + if (item.get("files") === false) { item.set("files", Immutable.List([])); } + + // Promote any url paths given to proxy to + // startPath option + if (item.get("proxy")) { + var path = item.getIn(["proxy", "path"]); + if (path !== "/") { + item.set("startPath", path); + } + } }); return browserSync.init(config, args.cb); diff --git a/lib/utils.js b/lib/utils.js index 13838bbaf..9764ecae7 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -347,6 +347,5 @@ module.exports.portscanner = portScanner; module.exports.UAParser = UAParser; module.exports.connect = require("connect"); module.exports.devIp = devIp; -module.exports.open = open; module.exports.serveStatic = require("serve-static"); module.exports.easyExtender = require("easy-extender");