Condition to ignore ".min.js" files

Asked

Viewed 40 times

1

I have the following task in my gulpfile.js which renames 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 to somehow bypass the Rename of files that are already ".min.js". Any idea how to do this?

1 answer

1


replace the code:

return gulp.src(paths.scripts.src)

By code:

return gulp.src([
  `${paths.scripts.src}/*.js`,
  `!${paths.scripts.src}/*.min.js`
])

Browser other questions tagged

You are not signed in. Login or sign up in order to post.