I want to minify some JS files with Gulp, but can't seem to get control over the process. I want only the minified version in the destination, and am currently getting copies of the originals as well.
I'm thinking I may need the rename package, but am not sure how to use it for this task - I would presumably need some kind of variable to hold the current file name for each script.
Any help much appreciated. The code is below:
var gulp = require( 'gulp' );
var minify = require( 'gulp-minify' );
var rename = require( 'gulp-rename' );
//script paths
var jsFiles = 'js/**/*.js',
jsDest = 'js/dist/';
gulp.task('scripts', function() {
return gulp.src(jsFiles)
.pipe(minify())
.pipe(gulp.dest(jsDest));
});
Set the noSource
config like the following
.pipe(minify({noSource: true})