1
我在gulpfile.js以下任务:如何使多条管线门面在咕嘟咕嘟任务
gulp.task('css', function() {
return gulp.src('theme.scss')
.pipe(...)
.pipe(...)
.pipe(...)
.pipe(...)
.pipe(...)
.pipe(...)
.pipe(gulp.dest('dist'));
});
,我想所有这些管道移动到一个模块中,以获得类似的东西:
gulp.task('css', function() {
return gulp.src('theme.scss')
.pipe(theme())
.pipe(gulp.dest('dist'));
});
这可能吗?
你也许可以创建一个单独的功能,如包裹(),它返回this.pipe(..) .pipe(..),然后在调用时将你的上下文绑定到它。比如'pipe(wrapped()。bind(this))',或类似的东西。现在在我的手机上,但我可以尝试稍后再玩。 – 2015-04-03 20:09:19