gulp-filter exclude pattern not matching anything

423 views Asked by At

I am trying to use gulp to (among other things) concatenate some js files, however some scripts are only used on certain pages and I want to keep them separate so they can be loaded only when needed. My goal is to use gulp-filter to exclude some files from being run through concat but filter seems to exclude ALL files and I don't understand why.

var paths = {
  src: {
    styles: ['client/styles/**/*.scss'],
    scripts: ['client/scripts/**/*.js'],
  },
  dest: {
    styles: 'assets/css',
    scripts: 'assets/js',
  }
};
gulp.task('frontend_scripts', function(){
  var globalFilter = gulpFilter(['*', '!client/scripts/pages']);

  gulp.src(paths.src.scripts)
    .pipe(globalFilter)
      .pipe(concat('global.js'))
    .pipe(globalFilter.restore())
    .pipe(gulp.dest(paths.dest.scripts))
  ;
});
0

There are 0 answers