Skip to content

Commit

Permalink
dx: look for default config in current directory
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Nov 20, 2016
1 parent 8515664 commit 2bf65b8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bin/browser-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var reloadOpts = require("../lib/cli/opts.reload.json");
var recipeOpts = require("../lib/cli/opts.recipe.json");
var pkg = require("../package.json");
var utils = require("../lib/utils");
var join = require("path").join;
var fs = require("fs");

/**
* Handle cli input
Expand All @@ -26,7 +28,15 @@ if (!module.parent) {
if (valid.indexOf(command) > -1) {
handleIncoming(command, yargs.reset());
} else {
yargs.showHelp();
var maybePath = join(process.cwd(), 'bs-config.js');
var maybeLocalConfigFile = fs.existsSync(maybePath);
if (maybeLocalConfigFile) {
var argv = yargs.reset().options(startOpts).argv;
argv.config = maybePath;
handleCli({cli: {flags: argv, input: ['start']}});
} else {
yargs.showHelp();
}
}
}

Expand Down

0 comments on commit 2bf65b8

Please sign in to comment.