Running a grunt task on one Gruntfile from another

后端 未结 4 1136
予麋鹿
予麋鹿 2020-12-24 02:18

I have a Gruntfile in the root of my project. I also have jQuery installed via Bower in an app/components/jquery directory.

As part of my Gruntfile I\'d like to run

4条回答
  •  情歌与酒
    2020-12-24 03:01

    Based on @Sindre's and @Stephen's answer, we can also get the console output "in real time" without being buffered:

    grunt.registerTask('run-grunt', function() {
      var cb = this.async();
      var child = grunt.util.spawn({
          grunt: true,
          args: ['clean', 'copy:fonts'],
          opts: {
              cwd: 'bower_components/bootstrap'
          }
      }, function(error, result, code) {
          cb();
      });
    
      child.stdout.pipe(process.stdout);
      child.stderr.pipe(process.stderr);
    });
    

提交回复
热议问题