I have list of glob patterns:
var assets = [
'../projects.a/dir1/dir2/file1.js',
'../projects.b/dir1/dir2/file2.js',
'./app/scripts/dir1/dir2/module.js'
];
I want to create a task that will copy all the files that represented by those patterns to my dest folder, and keep the structure. For example, in my dest folder I want the following:
'dest/projects.a/dir1/dir2/file1.js',
'dest/projects.b/dir1/dir2/file2.js',
'dest/app/scripts/dir1/dir2/module.js'
I built the following task:
gulp.task('scripts', ['clean'], function() {
return gulp.src(assets)
.pipe(gulp.dest('dest'));
});
The problem is that I get under 'dest' only one level of directories. For example:\
'dest/dir2/file1.js',
'dest/dir2/file2.js',
'dest/dir2/module.js'
Any idea what is wrong? How can I solve it?
What is the common approach of handling assets from different folders with gulp?
UPDATE
Looking on Looking for way to copy files in gulp and rename based on parent directory, I tried to set {base: './'}
as a parameter to gulp.src(assets, {base: './'})
but I get the files that under my current directory nested under another folder. I didn't get the needed behavior. Any idea?