gulp-grunt icon indicating copy to clipboard operation
gulp-grunt copied to clipboard

Using gulp-grunt my task never end.

Open nathanredblur opened this issue 9 years ago • 5 comments

Hi, Using require('gulp-grunt')(gulp); my other gulp task and grunt-task never end.

nathanredblur avatar Jan 21 '16 23:01 nathanredblur

What's your Gruntfile's block like? You have to return the stream, e.g.:

gulp.task('clean', function() {
  return gulp.start('grunt-clean:dist');
});

rebelliard avatar Jan 22 '16 17:01 rebelliard

I have this also, Just including grunt into the gulp file prevents the gulp functions from ending. i.e. running them individually. Are you saying to just put return on every grunt task will solve this also ? This is not possible in my scenario as I am using "gulpsync" to coordinate steps.

Smurf-IV avatar Jan 25 '16 07:01 Smurf-IV

@Smurf-IV Not quite. This setup works for me:

var gulp = require('gulp');

require('gulp-grunt')(gulp);

gulp.task('default', function() {
  return gulp.start('grunt-default');
});

gulp.task('serve', ['grunt-default'], function() {
  gulp.start('watch');
});

gulp.task('watch', function() {
  gulp.watch('**/*.js', function() {
    gulp.start('grunt-gulp:build');
  });
});

Previously, using grunt = require('gulp-grunt') did not work.

rebelliard avatar Jan 25 '16 22:01 rebelliard

Gulp.start is new for me. I was following the documentation https://github.com/gulpjs/gulp/blob/master/docs/API.md#deps

gulp.task('build', ['array', 'of', 'task', 'names']);

nathanredblur avatar Jan 26 '16 15:01 nathanredblur

If I comment out

require('gulp-grunt')(gulp);

then my individual gulp tasks exit when they have finished.

Putting it back in and using as you have suggested:

gulp.task('default', function() {
  return gulp.start('grunt-default');
});

Stop the gulp tasks from exiting. (i.e. not even running the grunt task)

Smurf-IV avatar Jan 27 '16 10:01 Smurf-IV