Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leading dot on glob leads to unexpected results #36

Open
robwierzbowski opened this issue Jul 27, 2014 · 3 comments
Open

Leading dot on glob leads to unexpected results #36

robwierzbowski opened this issue Jul 27, 2014 · 3 comments

Comments

@robwierzbowski
Copy link

It looks like the glob and regex matchers return true on empty streams. When I run the following tasks on a directory with no scss files:

gulp.task('styles', function () {
  return gulp.src(['app/styles/*.scss'])
    .pipe($.if('*.scss', gulpDebug() ))
    .pipe(gulp.dest('.tmp/styles'))
});
gulp.task('styles', function () {
  return gulp.src(['app/styles/*.scss'])
    .pipe($.if(/scss$/, gulpDebug() ))
    .pipe(gulp.dest('.tmp/styles'))
});

gulpDebug is fired both times.

This is mostly an issue when running gulp-changed along with a task that takes a while to spin up or errors with an empty stream.

I didn't test function conditions, so not sure what happens there.

@robrich
Copy link
Owner

robrich commented Jul 28, 2014

This is an intriguing scenario. Thanks for the repro steps. I'll take a look.

@robwierzbowski
Copy link
Author

No prob, and thanks! I dug into it a bit, but the function that does the matching is passed pretty deep into dependencies, debugging was beyond my ken.

@robrich
Copy link
Owner

robrich commented Sep 29, 2015

Turns out this is the fragile nature of passing things into minimatch that start with a dot. Changing it to ./**/*.scss seems to resolve the symptom. Leaving this open as that's hardly a great user experience.

@robrich robrich changed the title Matchers return true on empty streams Leading dot on glob leads to unexpected results Oct 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants