You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to solve a particular issue regarding the use of your library. I need to watch two different paths. However, the watch library does not concern that (I think). For instance, if I do the following code, it will run it over and over. But, on the other hand, if I use one of the paths, it will run everything ok.
var filePath001 = path.resolve(rootPath, 'foo001', 'foo002');
var filePath002 = path.resolve(rootPath, 'foo003', 'foo004');
watch.watchTree(filePath001, function (f, curr, prev) {
if (typeof f == "object" && prev === null && curr === null) {
shell.exec('./scripts/run.sh');
} else if (prev === null) {
shell.exec('./scripts/run.sh');
} else if (curr.nlink === 0) {
shell.exec('./scripts/run.sh');
} else {
shell.exec('./scripts/run.sh');
}
});
watch.watchTree(filePath002, function (f, curr, prev) {
if (typeof f == "object" && prev === null && curr === null) {
shell.exec('./scripts/run.sh');
} else if (prev === null) {
shell.exec('./scripts/run.sh');
} else if (curr.nlink === 0) {
shell.exec('./scripts/run.sh');
} else {
shell.exec('./scripts/run.sh');
}
});
My question is, how can I have watching of several paths?
Thank you in advance. I would appreciate an answer.
The text was updated successfully, but these errors were encountered:
@FMCalisto I don't think this is available by default.
I have the same concern and here is an example how someone could perform a watch on multiple directories.
// This file name is cssbundler.jsconstpath=require('path');constwatch=require('watch');consttargetListOfCss=['path/to/foo','path/to/bar'];targetListOfCss.forEach(cssPath=>{letfullcsspath=path.resolve(cssPath);watch.createMonitor(fullcsspath,(monitor)=>{monitor.on('changed',(fp,curr,prev)=>{console.log('do stuff to bundle '+fp);});});});
Greetings,
I am trying to solve a particular issue regarding the use of your library. I need to watch two different paths. However, the
watch
library does not concern that (I think). For instance, if I do the following code, it will run it over and over. But, on the other hand, if I use one of the paths, it will run everything ok.My question is, how can I have watching of several paths?
Thank you in advance. I would appreciate an answer.
The text was updated successfully, but these errors were encountered: