Skip to content

Suggestion: sink stack #5

@ghost

Description

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions