How to run bash commands in gulp?

后端 未结 3 1302
灰色年华
灰色年华 2020-12-23 12:41

I want to add some bash commands at the end of gulp.watch function to accelerate my development speed. So, I am wondering if it is possible. Thanks!

3条回答
  •  北海茫月
    2020-12-23 13:07

    The simplest solution is as easy as:

    var child = require('child_process');
    var gulp   = require('gulp');
    
    gulp.task('launch-ls',function(done) {
       child.spawn('ls', [ '-la'], { stdio: 'inherit' });
    });
    

    It doesn't use node streams and gulp pipes but it will do the work.

提交回复
热议问题