Incorrect relative path in gulp.dest() > vinyl-fs
Created by: demisx
I have an issue with relative path being incorrectly calculated in vinyl-fs
module used by gulp
. Please let me know if this should be entered under vinyl-fs
project instead.
When I pass gulp.src a direct path string, the relative.path in vinyl-fs/lib/dest/index.js
is set to the file name only, meaning it looses the directory prefix:
gulp.task "watch-less", ->
gulp.src "app/css/bootstrap-scoped.less"
.pipe gulp.dest('.build') # file.relative == 'bootstrap-scoped.less' (note: `css/` dir is lost)
return
However, if I pass a glob string instead of direct path, then the relative path is properly calculated and the directory prefix is present:
gulp.task "watch-less", ->
gulp.src "app/**/bootstrap-scoped.less"
.pipe gulp.dest('.build') # file.relative== 'css/bootstrap-scoped.less' (note: 'css/' directory is present)
return
This is a contrived example just to show where the issue exists. In our gulp build, this result in files being written to the wrong directory.