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

Suggestion: sink stack #5

Open
ghost opened this issue May 30, 2017 · 0 comments
Open

Suggestion: sink stack #5

ghost opened this issue May 30, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented May 30, 2017

I like the sink functionality. I just wish I didn't have to define a variable first. 95% of my tasks are single statements, and use arrow functions. Would like to be able to write, e.g.:

gulp.task( 'example', () =>
    gulp.src( [ 'foo/**/*.svg' ] )
    .pipe( clone.pushSink() ) // create a new sink, push it to stack
    .pipe( raster() ) // destructive editing
    .pipe( rename() )
    .pipe( clone.popSink() ) // pop sink from stack, tap sink
    .pipe( gulp.dest( '.' ) )
);

I don't think this would be hard to implement. Example:

const sinks = [];
clone.pushSink = () => {
	const sink = clone.sink();
	sinks.push( sink );
	return sink;
};
clone.popSink = () => sinks.pop().tap();
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

0 participants