

Gulp.js: The streaming build system - tombenner
http://gulpjs.com/

======
AdrianRossouw
I credit gulp with finally making me 'get' streams, even though I had tangled
with them before. It's API is one of the [1] biggest inspirations to code I
write nowadays and it also helped me come to grips with the fact that code >
config in almost every eventuality.

All of that said, webpack is so very far ahead of everything else in the field
that there is almost no way I would use anything else. It also has the side
effect of making gulp mostly unnecessary. Simple Makefiles or shell scripts
just get me a lot further nowadays.

[1] [https://github.com/GraftJS/graft](https://github.com/GraftJS/graft)

~~~
bronson
I had the same experience. Gulp is simple and beautiful once you get it. And
it's so much faster than Grunt.

Alas, at this point, my build needs are also being handled by Webpack. And, if
I'm faced with something weird, I'd first try to solve it with a Webpack
plugin. It's nowhere near as pretty as Gulp but it's the simplest to configure
and most comprehensive.

It's been a tumultuous few years for JS build systems...

------
bellerocky
I recently switched to using gulp and webpack (to build react.js) after having
used grunt for many years and I would encourage anyone still using grunt to
make the switch. All that pain and suffering to get your grunt build to work
will not be a problem. Setting up gulp is painless. It just worked. My setup
is less, jshint, wepback with react.js and bootstrap.

I encourage people to use webpack for any kind of js building unless you're
using browserfy, but you can use browserfy with straight up gulp. You could
also replace browserfy with webpack. Webpack will build your require.js (and
your commonjs) without need for almond.js if you're making single builds.
Setting up require.js with grunt was a nightmare, and a cinch with gulp +
webpack. Like it took me an entire day in the past with grunt, and like 5
minutes with gulp and webpack.

~~~
Sean-Der
I have been using Browserify for about 8 months on all my personal and work
projects and have really liked it. Since it seems like you have used both what
are your thoughts on Webpack and Browserify?

I have never used Webpack (and now very little about it), but was wondering if
it is worth investigating it?

~~~
AdrianRossouw
webpack uber alles.

start here : [https://github.com/petehunt/webpack-
howto](https://github.com/petehunt/webpack-howto)

~~~
thealphanerd
Fancy seeing you in a webpack thread :P

------
explorigin
A little OT:

People here are mostly saying to use webpack. Webpack is not a replacement for
all of gulp but does work well with it (as do the other JS builders).

I recently did a tour-of-duty looking for the best JS build system. I settled
on gulp early (over grunt) because grunt files were just too big to do the
same thing. But Gulp is not the best for some aspects of JS building (bundling
for multiple-pages). For those, I looked at RequireJS, Browserify and Webpack.
Here's my overview opinion:

\- RequireJS - a great starter and very powerful. Since it's old and not well-
liked in the NodeJS community, people seem to not give it the credit it is
due. Documentation could use some updating (some of the nuances of RequireJS
take some googling). The one feature that this has that others don't is that
you don't need a server to take advantage of it so you can start actually
coding now and optimize as your project grows. \- Browserify - great for
building libraries that you expect to run on NodeJS and in the Browser. But it
really falls short on building multiple bundles and dynamically loading
resources (it's possible, just annoying). Watchify (auto-building) is nice. \-
Webpack - The cream of the crop. Multiple pages, dynamic loading, auto-
bundling, built-in dev-server to monitor changes. If you have a project that
is more than one-page, use webpack.

When using any of these with gulp, I would not use the gulp plugins. Rather
use the NodeJS APIs alone. It may be a tad more cumbersome, but the gulp
plugins mostly just try to shoe-horn gulp's streaming into a file-based API
(and it's limiting).

------
goodafternoon
Right now, to me gulp is a clear winner if you compare it to grunt.

But let's not forget that grunt had been real forerunner. It's been the only
major build tool for years (probably also because streams weren't really as
mature when grunt was initially designed). So here's to pioneer Ben Alman, for
his immensely valuable contribution to the community!

------
webmaven
Previously on HN:

* [https://news.ycombinator.com/item?id=6822534](https://news.ycombinator.com/item?id=6822534)

* [https://news.ycombinator.com/item?id=7080077](https://news.ycombinator.com/item?id=7080077)

------
vlunkr
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.

~~~
aymericbeaumet
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

~~~
adamors
> 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](https://www.npmjs.org/package/run-sequence)

~~~
aymericbeaumet
I didn't know about it! Thanks

------
TheSisb2
Grunt isn't worse than Gulp. It may take longer to set up, but it is way more
powerful if you do it correctly. Maybe Gulp has evolved, but the last time I
used it (~4 months ago) it had its fair share of issues. If you're doing
simple tasks (uglify all of this folder to this folder) it works well. When I
used it there was no simple way to copy files from one dir to another. Instant
no for me there.

~~~
jffry
Something like this? IIRC this would've worked 4 months back:

    
    
      gulp.task('copy', function() {
        return gulp.src('src/foo/**/*').pipe(gulp.dest('dest/foo'));
      });

------
rblatz
Even as a .Net dev I'm loving gulp.js, I've got it worked into our builds
through MSBuild. and it has made our front end a lot nicer to work with.

------
AustinG08
My friend and co-worker created a gulp primer for wordpress development, take
a look: [http://www.ataylor.me/code/tutorials/using-gulp-js-in-
wordpr...](http://www.ataylor.me/code/tutorials/using-gulp-js-in-wordpress-
development/) (I love gulp)

------
dugmartin
I've switched most of my projects to Gulp from Grunt as I prefer code over
config. One thing that I wish Gulp did out of the box though would be not to
terminate on errors but rather beep without having to write .on('error', ...)
handlers.

~~~
pmx
You can add this to your gulpfile.js and it will just spew errors to the
console, and then keep going as if nothing happened.

    
    
      //Don't let node crash
      process.on('uncaughtException', function (err) {
        console.error(err);
      });

------
ankurpatel
There is also another alternative to gulp build system called Bud
[https://github.com/azer/bud](https://github.com/azer/bud)

------
securingsincity
Gulp is fantastic. for me coming from ant as a build process it made much more
sense to make that transition of code vs config like grunt

------
Kiro
Has anything changed? Posting a link to Gulp is like posting a link to Angular
or even Ruby on Rails.

~~~
alokedesai
Agreed, there's no reason this should be on the front page of HN.

