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

Remove .pipe method #107

Closed
phated opened this issue Sep 7, 2016 · 5 comments
Closed

Remove .pipe method #107

phated opened this issue Sep 7, 2016 · 5 comments
Assignees
Milestone

Comments

@phated
Copy link
Member

phated commented Sep 7, 2016

This method seems like really old cruft that doesn't belong.

A few reasons I think it should be removed:

  • Vinyl isn't actually a stream, so having a pipe method could confuse duck-typing
  • The pattern for dealing with streams in plugins is:
if (file.isStream()) {
  file.contents = file.contents.pipe(transform());
}

@contra do you agree?

@phated phated modified the milestone: 2.0 Sep 7, 2016
@phated phated self-assigned this Sep 7, 2016
@yocontra
Copy link
Member

yocontra commented Sep 7, 2016

@phated yep

@phated phated closed this as completed in d14ba4a Sep 8, 2016
kt3k added a commit to kt3k/vinyl-serve that referenced this issue Oct 16, 2016
@twolfson
Copy link

twolfson commented Nov 6, 2016

Are there plans to replace .pipe() with another method? I know it's a small increase of 1 line to 3 lines but it winds up bloating all downstream plugins =/ (e.g. now I'm responsible for testing buffers/streams are handled consistently)

@binarykitchen
Copy link

With the removal of this bad pipe function many gulp plugins do not work anymore. Trying to fix one with this old code:

      file // instance of Vinyl
        .pipe(split2())
        .pipe(through(someFunction(),  function(callback) {
          if (content.length) {
            file.contents = new Buffer(content.join('\n'));
            that.push(file);
          }
          // callback();
          cb();
        }));

file comes from var stream = through2.obj(function(file, enc, cb) {

How to fix this best?

@yocontra
Copy link
Member

@binarykitchen This ticket was for the removal of a really old function file.pipe that was never really used or adopted. file.contents = file.contents.pipe(whatever) is the replacement for this case. There are a bunch of issues with your example code, but that's more something you should get help with on StackOverflow or similar.

@binarykitchen
Copy link

Right, thanks

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

4 participants