hustxiaoc / gulp-minify

minify js plugin for gulp
BSD 2-Clause "Simplified" License
65 stars 20 forks source link

ignoreFiles doesn't work #14

Closed OZZlE closed 8 years ago

OZZlE commented 8 years ago

I have the following:

gulp.task('build-js', function() {
    return gulp.src(['js/src/**/*.js', '!JS_TEMPLATE_FULL.js, !JS_TEMPLATE_MIN.js'])
        .pipe(plumber(function (error) {
            gutil.log(error.message);
            this.emit('end');
        }))
        .pipe(minify({
            noSource: false,
            ignoreFiles: ['min.js']
        }))
        .pipe(gulp.dest('js/dist'))
        .pipe(browserSync.reload({stream:true}))
        ;
});

I've tried with: ignoreFiles: ['min.js'] and ignoreFiles: ['.min.js'](my files are .min) but it still minifies those and appends the -min.js to the file name

OZZlE commented 8 years ago

sorry my misstake

jeherve commented 5 years ago

I stumbled across this issue when running into similar issues. It turns out I was getting confused by the default behaviour of gulp-minify: it creates new files with the min extensions. This can be disabled as explained here: https://github.com/hustxiaoc/gulp-minify/issues/20#issuecomment-300669882

howeller commented 5 years ago

@OZZlE What was your solution? I am having the same issue of changing the default to .min, but then it it creates a new copy of .min.min

mreall commented 1 year ago

@OZZlE What was your solution? I am having the same issue of changing the default to .min, but then it it creates a new copy of .min.min

@howeller I had the same question. After a bit of testing I was able to get ignoreFiles to work by putting an asterisk at the beginning of the file extension, i.e. ignoreFiles: ['*.min.js'].