I am currently refactoring a project where previously all of the minified JavaScript files were being placed in a specific directory. Now I need to the minified versions to stay in the same directories as their source files.
Currently I do this:
gulp.task( 'scripts', function () {
return gulp.src( source_paths.scripts )
.pipe( uglify( {
preserveComments: 'false'
} ) )
.pipe( rename( {suffix: ".min"} ) )
.pipe( gulp.dest( './build/js' ) )
.pipe( notify( {
message: 'Scripts task complete!',
onLast : true
} ) );
} );
This works, except it moves my files. I tried changing my use of gulp.dest()
to .pipe( gulp.dest( '' ) )
as well as just removing that line. In both cases no minified JS was written and I was very sad.
How can I make it write all files to the same directory as their source files?