Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
watcher: adding cwd + ignore defaults to all
- Loading branch information
1 parent
f72a6ad
commit dbb1267
Showing
7 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* | ||
* Install: | ||
* npm install browser-sync | ||
* | ||
* Run: | ||
* node <yourfile.js> | ||
* | ||
* This example will create a server using https using the default information & use the `app` directory as the root | ||
* | ||
*/ | ||
|
||
"use strict"; | ||
|
||
var browserSync = require("browser-sync").create(); | ||
|
||
browserSync.init({ | ||
server: "test/fixtures", | ||
watch: true | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export function addCwdToWatchOptions(incoming) { | ||
return incoming.updateIn(['watchOptions', 'cwd'], (watchCwd) => { | ||
return watchCwd || incoming.get('cwd'); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var cli = require("../../../dist/cli/cli-options"); | ||
var merge = cli.merge; | ||
var assert = require("chai").assert; | ||
|
||
describe("CLI: Options: dealing with 'ignore' option", function() { | ||
it("watches in server mode (no files given)", function() { | ||
var cwd = '/Users/shakyshane/app'; | ||
var input = { server: true, files: ['**/*'], ignore: ['**/*.php'], cwd: cwd }; | ||
var config = merge(input).toJS(); | ||
assert.deepEqual(config.files, { core: { globs: ["**/*"], objs: [] } }); | ||
assert.ok(config.watchOptions.ignored.indexOf('**/*.php') > -1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var cli = require("../../../dist/cli/cli-options"); | ||
var merge = cli.merge; | ||
var assert = require("chai").assert; | ||
|
||
describe("ensures the CWD is transferred to the watchOptions.cwd ", function() { | ||
it("add cwd with files option", function() { | ||
var cwd = '/Users/shakyshane/app'; | ||
var input = { server: true, files: "**/*.html", cwd: cwd }; | ||
var config = merge(input).toJS(); | ||
assert.deepEqual(config.watchOptions.cwd, '/Users/shakyshane/app'); | ||
}); | ||
}); |