Reputation: 549
This gulp.watch copies the file ../server confs/oc.fr/http.conf
to the directory server_etc_httpd_conf/
when changed/saved:
gulp
.watch(['../server confs/oc.fr/httpd.conf'])
.on('change', function(path) {
gulp
.src(path)
.on('end', function(){ log('pass 1: '+path); })
.pipe(gulp.dest('server_etc_httpd_conf/'))
.on('end', function(){ log('pass 2: '+path); });
});
Output:
[09:39:05] Starting 'watch'...
[09:39:12] pass 1: ../server confs/oc.fr/httpd.conf
[09:39:12] pass 2: ../server confs/oc.fr/httpd.conf
But when I change the watch list to use a wild card:
.watch(['../server confs/oc.fr/.'])
the output messages are identical, but the file does not actually get copied. I tried: *.conf
*
*.*
.
- they all enter the function correctly as the pass messages show, but no file is being copied. What's wrong?
EDIT: Now I discovered, that, if using the wild card .
, gulp.dest will create a new, relative target directory server confs/oc.fr/
and store the output file there. I still don't understand this behavior. The output path 'server_etc_httpd_conf/' is explicitly given to gulp.dest.
Upvotes: 0
Views: 119
Reputation: 549
Add the base property to gulp.src, if using relative source paths containing ..
.src(path, {"base": "../server confs/oc.fr/"})
Upvotes: 0