I have a structure like
They all contain different js-files, I'd like to uglify them and output them to the same directory
The script below will only output them to
I'd like to have them all in wwwroot/scripts, I do not wish to concat any files.
gulp.task('site-js', function () {
var files = [
'wwwroot/lib/site/scripts/**/*.js'
];
return gulp.src(files)
.pipe(uglify())
.pipe(gulp.dest('wwwroot/scripts/'));
});
Sounds like gulp-rename
is what you're looking for:
gulp.src('wwwroot/lib/site/scripts/**/*.js')
.pipe(rename(path => { path.dirname = "" })) // remove relative path
.pipe(gulp.dest('wwwroot/scripts/'));