如何在gulp中将文件通过管道传递给shell命令

时间:2018-12-12 07:07:17

标签: javascript gulp

我想使用gulp通过Unix管道对shell命令执行某些操作,并且gulp-run看起来不错,但已经过时了(https://github.com/MrBoolean/gulp-run/issues/52)。

有什么办法吗?

var run = require('gulp-run');

// use gulp-run in the middle of a pipeline:
gulp.task('even-lines', function() {
  return gulp
    .src('path/to/input/*')             // get input files.
    .pipe(run('awk "NR % 2 == 0"'))     // use awk to extract the even lines.
    .pipe(gulp.dest('path/to/output'))  // profit.
  ;
});

// Error: Received a non-Vinyl object in `dest()`

0 个答案:

没有答案
相关问题