News for hackers. Stuff that matters.
Re:Gulp.js: The streaming build system by vlunkr on Thursday August 21, 2014 @11:47AM (#8207910)
I've been using Gulp for a couple of months now, it's great! It's like Grunt, but faster, and the tasks are written in code, not a giant JSON config file.
Re:Gulp.js: The streaming build system by aymericbeaumet on Thursday August 21, 2014 @12:12PM (#8208071)
Even though they are clearly related, Gulp and Grunt are fulfilling different purposes. You should carefully examined your needs before choosing one over another.

I recently switched to Gulp for several projects, and I'm thinking of switching back to Grunt.

Gulp lacks of some important features. For instance, it does not allow to sequentially execute tasks: everything is done in parallel. This could for sure be emulated by using async, but the overhead is not worth it.

On the other side, Grunt does support sequential and parallel tasks execution, but is more verbose and does a lot of file writing on the disk (though it is relatively moderate).

One concrete example for sequential tasks execution (easily done with Grunt):

- Watch JavaScript files, when a modifications is detected:

  - lint files -> [JSHint, JSCS]

  - if success: launch tests -> [Karma, Mocha]

  - if success: notify
- If any failure occurs: notify and abort the sequence
Re:Gulp.js: The streaming build system by adamors on Thursday August 21, 2014 @01:09PM (#8208399)
> it does not allow to sequentially execute tasks: everything is done in parallel

There's a package[1] for Gulp which does exactly that.

[1]: https://www.npmjs.org/package/run-sequence

Re:Gulp.js: The streaming build system by aymericbeaumet on Thursday August 21, 2014 @04:40PM (#8209465)
I didn't know about it! Thanks
Re:Gulp.js: The streaming build system by terinjokes on Thursday August 21, 2014 @01:05PM (#8208364)
We're adding the ability to handle sequential tasks (and other cool combinations) in Gulp 4. See bach[1] for some ideas.

[1]: https://github.com/phated/bach

Re:Gulp.js: The streaming build system by aymericbeaumet on Thursday August 21, 2014 @04:51PM (#8209519)
I remember some discussions on Gulp's issues tracker where maintainers were reticent about integrating sequential tasks execution.

But that's great if you are going to do it. This may make me come around and give a second chance to Gulp.

Re:Gulp.js: The streaming build system by vlunkr on Thursday August 21, 2014 @01:14PM (#8208420)
There are ways, like others have said. There is also a callback system you can use to make things sequential, but last time I looked it wasn't well documented
Re:Gulp.js: The streaming build system by aymericbeaumet on Thursday August 21, 2014 @05:14PM (#8209649)
There are always ways. But I find Grunt much more handy to do it.
Re:Gulp.js: The streaming build system by Recoil42 on Thursday August 21, 2014 @01:05PM (#8208367)
"For instance, it does not allow to sequentially execute tasks: everything is done in parallel."

This is false. You can set perquisites for a task, which will be executed in sequence.

Re:Gulp.js: The streaming build system by aymericbeaumet on Thursday August 21, 2014 @05:08PM (#8209620)
I think you are talking about this[1], indeed you are right.

However, task dependencies allows sequential tasks execution, but that's not very handy as you may want a same task to be executed in two different sequences.

Let's see a simple example on which I honestly struggle to reproduce with Gulp:

  [Lint, Test] -> Concatenation -> Minification

  Watch -> [Lint, Test] -> LiveReload
How would you do such a setup without having a redundancy in your tasks declaration?

[1]: https://github.com/gulpjs/gulp/blob/master/docs/recipes/runn...

Re:Gulp.js: The streaming build system by cwbrandsma on Thursday August 21, 2014 @11:56AM (#8207966)
The grunt config is javascript, not json. So you can write custom tasks code in your grunt config.

For instance, I wrote a custom tag to modify specific pages to inject javascript include statements in HTML pages. There is probably a plugin for that, but I was able to write the code in 15 minutes so I didn't care.

Re:Gulp.js: The streaming build system by Guillaume86 on Thursday August 21, 2014 @12:09PM (#8208056)
I use https://www.npmjs.org/package/gulp-inject to do it with gulp, works fine
Re:Gulp.js: The streaming build system by vlunkr on Thursday August 21, 2014 @01:12PM (#8208412)
I know it is, but the majority of the tasks are configured in one big hash.
Re:Gulp.js: The streaming build system by mattdawson on Thursday August 21, 2014 @01:40PM (#8208579)
Yeah, but it's also trivially easy to wrap a 3rd party task in your own task and munge the config at run time. (I'll admit that that pattern didn't become apparent to me until after using Grunt for some months, but once I saw you could do that, many things that seemed onerous got easier.)
Re:Gulp.js: The streaming build system by goodafternoon on Thursday August 21, 2014 @11:57AM (#8207971)
Same here, have been using it for personal projects for a couple of months and it outperforms grunt by a long shot.
Re:Gulp.js: The streaming build system by kdlmm on Thursday August 21, 2014 @11:57AM (#8207973)
I agree! Also using it since a few months and couldn't go back to Grunt!