1
For reasons beyond my control, I have my source code in separate and unrelated directories. Like this:
diretorioPai
foo
serverSideJS
clientSideJS
bar
serverSideJS
clientSideJS
I set up the Browserify (with watchify) to use multiple inputs and have only one output. My problem is that the watchify only accompanies a directory - The first in the list of entries. It does not detect changes in the second directory (nor of others more that I add). I have found that no errors are triggered.
Those are the relevant parts of my gulpfile
:
gulp.task('js', function () {
var dir1 = '/diretorioPai/foo/clientSideJS';
var dir2 = '/diretorioPai/bar/clientSideJS'
var opts = {
entries: [dir1, dir2]
}
opts = xtend(opts, watchify.args);
var bundler = browserify(opts);
bundler = watchify(bundler);
bundler.on('update', function (file) {
gutil.log('Arquivo ' + file + ' alterado.');
rebundle();
});
function rebundle () {
return bundler
.bundle()
.on('error', function (e) {
gutil.log('Error durante a compilação. : ' + e);
})
.on('finish', function (e) {
gutil.log('Pronto.');
})
.pipe(source('app.js'))
.pipe(gulp.dest('/diretorioDeSaida/JS'));
}
return rebundle();
});
How do I make for the Browserify, or at least the Browserify, track files in several directories and compile what you find in one file only?