I have following stucture of the project:
- _build/
- build-tools/
- gulpfile.js
- someFolder/
- excludeFolder/
- index.html
I want to copy all the files except _build
and 'excludeFolder' dir to the _build/release
directory.
I am using this gulp task:
gulp.src(['*',
'!_build/**/*',
'!build-tools/**/*',
'!excludeFolder/**/*'],{base:'..'})
.pipe(gulp.dest('_build/release'));
How can I command Gulp to start relative path from upper root directory, or any other directory that the gulfile.js is located?
As far as I understand the behavior your looking is cwd
, not base
gulp.src([
'**',
'!_build',
'!_build/**',
'!build-tools',
'!build-tools/**',
'!excludeFolder',
'!excludeFolder/**'
],{ cwd:'..' })
.pipe(gulp.dest('_build/release'), { cwd: '..' });
base
is a tricky property, which aims to say to gulp where to start copying the files based on the cwd
, but that doesn't mean that you can omit the parent folder ..
call on gulp.src
(your case specifically).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With