Condition to ignore files".min.js"

I have the following task in my gulpfile.js renaming files .js for .min.js :

gulp.task('js', function () {
    return gulp.src(paths.scripts.src)
            .pipe(gulpif(prod, uglify()))
            .pipe(rename({ suffix: '.min' }))
            .pipe(gulp.dest(paths.scripts.dest));
});

However, I need somehow to ignore the Rename of files that are already".min.js'. Any idea how to do this?

Author: Fábio Jânio, 2017-11-12

1 answers

Replace the Code:

return gulp.src(paths.scripts.src)

By Code:

return gulp.src([
  `${paths.scripts.src}/*.js`,
  `!${paths.scripts.src}/*.min.js`
])
 1
Author: Thiago Franchin, 2019-01-13 02:08:18