I need some help.
How to move files from different folders to ONE folder, without subfolders in Gulp?
For example my project structure:
build/
js/
source/
/modules
/list
- list.js
/editor
- editor.js
/menu
- menu.js
I need to move all js files from source to build/js:
build/
/js
- list.js
- editor.js
- menu.js
I have code:
gulp.task('build-partials', function(){
gulp.src('source/modules/*/*.js', {base: 'source/modules/'})
.pipe(gulp.dest('build/js/'))
});
But in build/js/ i see this:
build/
/js
/list
- list.js
/editor
- editor.js
/menu
- menu.js
Try using gulp-flatten
var flatten = require('gulp-flatten');
gulp.task('scripts', function () {
gulp.src(['source/modules/**/*'])
.pipe(flatten())
.pipe(gulp.dest('build/js/'));
});