Skip to content

Commit

Permalink
Removes glob-watcher middle-man and use upstream dependency instead (…
Browse files Browse the repository at this point in the history
…chokidar)
  • Loading branch information
zachleat committed Dec 19, 2018
1 parent 0351123 commit b73af8c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@
"dependencies": {
"browser-sync": "^2.24.7",
"chalk": "^2.4.1",
"chokidar": "^2.0.4",
"debug": "^4.0.1",
"dependency-tree": "^6.3.0",
"ejs": "^2.6.1",
"fast-glob": "^2.2.2",
"fs-extra": "^7.0.0",
"glob-watcher": "^5.0.1",
"gray-matter": "^4.0.1",
"hamljs": "^0.6.2",
"handlebars": "^4.0.12",
Expand Down
16 changes: 13 additions & 3 deletions src/Eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,17 @@ Eleventy.prototype._watch = async function(path) {
}
};

Eleventy.prototype.getWatcher = function() {
return this.watcher;
};

Eleventy.prototype.watch = async function() {
this.active = false;
this.queuedToRun = false;

await this.write();

const watch = require("glob-watcher");
const chokidar = require("chokidar");

let rawFiles = this.eleventyFiles.getGlobWatcherFiles();
// Watch the local project config file
Expand All @@ -270,11 +274,17 @@ Eleventy.prototype.watch = async function() {
);
debug("Watching for changes to: %o", rawFiles);

let ignores = this.eleventyFiles.getGlobWatcherIgnores();
debug("Watching but ignoring changes to: %o", ignores);

console.log("Watching…");
let watcher = watch(rawFiles, {
ignored: this.eleventyFiles.getGlobWatcherIgnores()
let watcher = chokidar.watch(rawFiles, {
ignored: ignores,
ignoreInitial: true
});

this.watcher = watcher;

async function watchRun(path) {
try {
await this._watch(path);
Expand Down

0 comments on commit b73af8c

Please sign in to comment.