sindresorhus / gulp-filter

Filter files in a `vinyl` stream
MIT License
315 stars 37 forks source link

Glob returns an empty stream #65

Closed drgullin closed 8 years ago

drgullin commented 8 years ago

filter(glob) returns an empty stream (no result) in this function (current glob doesn't work):

gulp.task('views', function() {
  return gulp.src('source/views/**/*.jade')
    .pipe(filter([ '*.jade', '!{_*.jade,includes/**,_backup/**}' ]))
    .pipe(jade())
    .pipe(gulp.dest('public'))

while a nearly identical function (with a same glob) works well:

gulp.task('views', function() {
  return gulp.src('source/views/**/*.jade')
    .pipe(filter(function(file) {
      var match = multimatch([file.relative], [ '*.jade', '!{_*.jade,includes/**,_backup/**}' ])
      if (match.length)
        return file
    }))
    .pipe(jade())
    .pipe(gulp.dest('public'))

Am I doing something wrong?

"gulp": "^3.9.1" "gulp-jade": "^1.1.0" "gulp-filter": "^4.0.0"

ai commented 8 years ago

We have same issue after 3.0.1 → 4.0.0 update (also having no ChangeLog is a bad practice in this case :( ).

ai commented 8 years ago

@sindresorhus our example is filter(['**/*', '!*.map']) and filter('*.{js,css}', { restore: true })

drgullin commented 8 years ago

@ai in 4.0 a file.relative patterns became path.relative by @cb1kenobi pr https://github.com/sindresorhus/gulp-filter/pull/59 Filter now looks into the root of your project, not a current src of your pipe https://github.com/sindresorhus/gulp-filter/pull/61

Can be fixed now by switching back to v3.

drgullin commented 8 years ago

I'm closing current issue and giving :+1: to https://github.com/sindresorhus/gulp-filter/pull/61

ai commented 8 years ago

Ouh, this simple one line in ChangeLog or GH Released may save so many time for my project :'(.

@sindresorhus it is very easy to miss some detail in big PR. ChangeLog is very important :(.