gulp-filter is filtering everything.
I'm trying to use gulp-filter to exclude a single file from gulp-uglify:
var uglify = require('gulp-uglify');
var filter = require('gulp-filter');
var paths = {
css: 'src/*.css',
html: 'src/*.html',
js: 'src/*.js'
};
gulp.task('js', function() {
// Create a filter for the ToC options file. We don't want to minify that.
var f = filter(['*', '!src/ToCOptions.js'], {"restore": true});
return gulp.src(paths.js)
.pipe(f)
.pipe(uglify())
.pipe(f.restore)
.pipe(gulp.dest('js'));
});
I've read gulp-filter filters out all files, which seems to be the same problem, but the accepted answer doesn't work for me.
I've tried several variations on the filter, including:
var f = filter(['*', '!ToCOptions.js'], {"restore": true});
Nothing processed by gulp-uglify.var f = filter('!ToCOptions.js', {"restore": true});
Nothing processed by gulp-uglify.var f = filter('!src/ToCOptions.js', {"restore": true});
Nothing processed by gulp-uglify.var f = filter('src/ToCOptions.js', {"restore": true});
Only the file I wanted to exclude was processed by gulp-uglify.var f = filter(['*', 'src/ToCOptions.js'], {"restore": true});
Only the file I wanted to exclude was processed by gulp-uglify.var f = filter(['*', '!/src/ToCOptions.js'], {"restore": true});
Nothing processed by gulp-uglify.var f = filter(['*', '!/ToCOptions.js'], {"restore": true});
Nothing processed by gulp-uglify.
What am I doing wrong?