Live data from Hacker News

Gulp.js: The streaming build system

gulpjs.com

11–20 of 53 posts

Re: Gulp.js: The streaming build system

#12
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!

Re: Gulp.js: The streaming build system

#13
post #2

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.

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.

I use https://www.npmjs.org/package/gulp-inject to do it with gulp, works fine

Re: Gulp.js: The streaming build system

#14
post #2

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.

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

#15

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 buil…

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?

Re: Gulp.js: The streaming build system

#16
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

Re: Gulp.js: The streaming build system

#17

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 buil…

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?

webpack uber alles.

start here : https://github.com/petehunt/webpack-howto

Re: Gulp.js: The streaming build system

#18

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 buil…

I think this is a perfect example of why in 2014 Javascript is harder than ever for someone to learn. I'd love to get your take as someone who seems to be using the latest cool stuff as to how to mitigate that?

I personally learned JS circa 2006 in the jQuery era and now I'm in a position where web-minded individuals ask me how to learn JS but they are "10 steps ahead" asking questions like react vs ember, ember vs angular, etc. Thoughts? Do they basically have to learn up the chain? I guess what I'm saying is there is a lot of history that I'm not sure can be skipped?

Re: Gulp.js: The streaming build system

#19

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 buil…

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?

Webpack is really easy to use and works very nicely with commonjs/nodejs style `module.exports` and `require` which is how I use it now. The place where it becomes incompatible is with the syntax that webpack adds to require statements. Stuff like `require("css!./file.css");` So you could use webpack to build things you once built with browserify, but if you start using `css!` you can't go back easily.

I prefer webpack just because how easy it is to use and how fast it is. It comes with its own watcher too, but I use gulp watch since I use gulp for building less, not the webpack less loader. I haven't wrapped my head around using `require` statements for less just yet.

Re: Gulp.js: The streaming build system

#20

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.

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);
  });
Post reply on HN