generator-kraken icon indicating copy to clipboard operation
generator-kraken copied to clipboard

Allow For Choice Between Grunt and Gulp

Open caffeinewriter opened this issue 9 years ago • 8 comments

As nice as Grunt is, I'm a Gulp user, so during the Yeoman generation, it'd be nice to have the option to choose between Grunt and Gulp.

caffeinewriter avatar Feb 28 '15 03:02 caffeinewriter

and broccoli +1

hegdeashwin avatar Apr 21 '15 14:04 hegdeashwin

Agree. We should work on a gulp variant. I just now heard of broccoli. So many build thingies out there. PRs welcome of course!

grawk avatar Apr 21 '15 14:04 grawk

Hi, I have noticed that some of your grunt tasks rely on grunt modules that were written by kraken team. If someone started working on gulp compatibility, would your team provide same modules but ported for gulp task runner? If community created those gulp ports for you, would you support them later?

qlonik avatar Jul 10 '15 01:07 qlonik

Sorry for letting this issue languish. I'll make a pass at what modules we would need to author in order to support a gulp option for generated kraken apps and add it here.

grawk avatar Jul 10 '15 05:07 grawk

I started implementing gulp support in generator. You can check it out here: https://github.com/qlonik/generator-kraken/tree/gulp_support. It was not that hard to do, since you already had good prompt system.

The main problem is replacing grunt tasks with gulp tasks so they have the same functionality. While I already replaced few of those tasks, I am not sure how to replace those that rely on kraken team written ones.

Another question would be about implementation of those gulp tasks. While you could probably have those node_modules create new gulp tasks with predefined names (similar to what happens in grunt), it does not seem that this was the ideology of gulp, it does not seem that they like implicitly declared tasks.

I thought following snippets could be a good example of what I meant in the last paragraph:

// Gulpfile.js
var gulp = require('gulp');
require('gulp-implicit-task');
// node_modules/gulp-implicit-task/index.js
var gulp = require('gulp');

gulp.task('implicit-task', function() {
   return gulp.src('public/**/*.js')
      .pipe(doSomething())
      .pipe(gulp.dest('build'));
});

This would be an example of implicitly declared task (if it works).

However, what Gulp would want to happen is for node_module to export function that could be used as a callback for gulp.task():

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

gulp.task('taskName', task);

or they would want to have node_module return function that accepts 'stream' and could be used in a pipe chain:

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

gulp.task('taskName', function() {
   return gulp.src('public/**/*.js')
      .pipe(task()) // or .pipe(task)
      .pipe(gulp.dest('build/'));
});

qlonik avatar Jul 16 '15 02:07 qlonik

That last option sounds the most promising -- and possibly gives a reusable unit that's usable outside of gulp.

aredridel avatar Jul 16 '15 14:07 aredridel

Hi, sorry for letting this issue drag along without any change. Indeed the last option is the most flexible, and most gulp modules go with last approach. However, I dont think that it would be possible to reuse unit outside of gulp. That gulp's pipe thing is similar to express's use function where it expects parameter in specific format which would be hard to mimic outside of gulp.

On the side note, as I mentioned last time, I had made some progress towards gulp support. With the summer ending, I have less available time, so I would not be able to finish this feature until gulp option is a complete replacement for grunt option. Would those changes/commits be useful for you? If so, what should I do, so these changes are not lost?

Thank you, qlonik.

qlonik avatar Aug 21 '15 00:08 qlonik

Certainly worth a look! Feel free to make a PR and say it's just conceptual / work in progress whatever!

aredridel avatar Aug 23 '15 02:08 aredridel