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

make it posible to skip files #16

Closed
wants to merge 2 commits into from
Closed

make it posible to skip files #16

wants to merge 2 commits into from

Conversation

fentas
Copy link

@fentas fentas commented May 31, 2015

Hi there,
if using the callback (async) handler it is impossible to skip files (like mentioned in issue #13 with sync)..
Like this

gulp.task('json-test', function() {
  return gulp.src('./examples/test1.html')
    .pipe(data(function(file, cb) {
      some_async_stuff(function() { cb(undefined, null); });
    }))
    .pipe(swig())
    .pipe(gulp.dest('build'));
});

I changed only that it checks what kind of return it gets, and if null it skips it.

@shinnn
Copy link
Contributor

shinnn commented Jun 25, 2015

LGTM

@colynb colynb closed this Nov 26, 2015
@fentas
Copy link
Author

fentas commented Nov 27, 2015

This is only sad. Closing a pull request without saying why.

@colynb
Copy link
Owner

colynb commented Nov 27, 2015

I was in a hurry cleaning things up and didn't intend to. Sorry!

@colynb colynb reopened this Nov 27, 2015
@colynb
Copy link
Owner

colynb commented Nov 27, 2015

Can you explain what you're trying to solve? I tried to create a test for it, but it fails.

@fentas
Copy link
Author

fentas commented Nov 27, 2015

Hey thanks for replaying! 👍
What is failing?
Simply I wanted to be able to filter/skip files.

gulp.task('json-test', function() {
  return gulp.src('./**/*.json')
    .pipe(data(function(file, cb) {
      // [...]
      // not return file to next pipe
      cb(undefined, null);
    }))
    .pipe(data(function(file,cb) {
      // filtered file collection.
    })
});

@colynb
Copy link
Owner

colynb commented Nov 30, 2015

Going back the the original issue (#13) which seems slightly different than your use-case. You're using gulp to iterate over JSON files (rather than html templates). Just so there's no confusion, there are 2 categories of files we're dealing with here: the files gulp is iterating over (using the glob pattern), and the JSON files you might choose to import into file.data using gulp-data. I'm not exactly sure what you're trying to do, but it doesn't seem to be a task that's best suited for gulp-data. The primary concern of gulp-data is to attach a data property to the file object (file.data) that can be used downstream for other plugins like gulp-swig or gulp-jade. If you're using gulp-data to filter out files that have been loaded with the glob pattern, then I think there's a better plugin out there for that.

@fentas
Copy link
Author

fentas commented Nov 30, 2015

Ah. Ok. If this is so I guess I'll close this pull then. Thanks for the response! : )

@fentas fentas closed this Nov 30, 2015
@colynb
Copy link
Owner

colynb commented Nov 30, 2015

see if gulp-filter is what you're looking for

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

Successfully merging this pull request may close these issues.

None yet

3 participants