Live data from Hacker News

Grunt and RequireJS are out, it's all about Gulp and Browserify

100percentjs.com

11–20 of 163 posts

Re: Grunt and RequireJS are out, it's all about Gulp and Browserify

#11
post #9
post #3

Gulp looks very interesting. Browserify vs. RequireJS seems more complex to me, though - it isn't difficult to use RequireJS in the CommonJS pattern. When I tried Browserify it was incredibly slow to build - but that might have been me setting it up wrong in Grunt...

I think the author oversimplified the choice of Browserify and RequireJS. They have some overlap, but are not 100% replacements. Both have the concept of modules, and they overlap in this area. Browserify allows you to use Node style modules in the browser. RequireJS allows you to asynchronously load parts of your app, while Browserify bundles all JS into a single file.

To further clarify, RequireJS also allows you to bundle all JS into a single file via the r.js build step.

If you're planning on going that route with RequireJS, you should also look into AlmondJS: https://github.com/jrburke/almond

Re: Grunt and RequireJS are out, it's all about Gulp and Browserify

#12
post #7

There have been numerous posts stating that Gulp is faster than Grunt. However, the "faster" argument needs to be qualified with "under these conditions ____". Even better, here's my configuration. Here's the processing time of x and of y. With JavaScript builds in particular, it's important to separate when the task running is used. At least in my workflow, I have two distinct times: 1. Development time 2. Build tim…

If you want to compare build time, it would be best to add plug-ins that trigger only the tasks that deal with changed files:

https://github.com/osteele/grunt-update

https://github.com/goodeggs/grunt-skippy

https://github.com/aioutecism/grunt-diff

https://github.com/sindresorhus/gulp-changed

Re: Grunt and RequireJS are out, it's all about Gulp and Browserify

#15
post #2

... and now we have fez: https://github.com/fez/fez https://news.ycombinator.com/item?id=7090479

To be honest, I wish people would stop mentioning this project until it actually usable for real projects. I have attempted to build a sass task for Fez and failed when I realized that the core project simply does not have the ability to be configured to do very simple things. In the case of the sass plugin, Fez does not support globs, making it difficult/hacky to properly ignore files prefixed with "_", a well-known sass convention.

I agree that Grunt syntax is not fantastic. It has improved since 0.4 but the reality is that the average "long" Grunt build has a whole ton of customization thrown into the mix that is simply not possible with newer tools such as Gulp or Fez.

Additionally I really don't think that the comparisons are fair. Yes, it's nice to declare a fileset and define transformations on it, rather than defining transformations and declaring which files you want to use with each one. But I could easily show you an easy-to-read Grunt configuration that is just as simple as the ones you see in Fez or Gulp marketing.

I applaud what these tools are attempting to do, but we need to keep the comparisons fair.

Re: Grunt and RequireJS are out, it's all about Gulp and Browserify

#16
On a project that I'm working I recently converted a ~260 line Rakefile into ~150 lines of gulp ... and our build is now almost instantaneous (took a few seconds to do with Ruby, mainly because we had to shell out to things like the less compiler). Oh, and we were also able to build our gulpfile.js in just a few hours after hearing about it for the first time.

I never went the Grunt route because I just can't get used to programming with massive, multi-tiered object literals. If you've ever seen a Gruntfile, you know what I mean. It's all configuration, very little real code.

With gulp, code trumps configuration. And the result is incredibly concise and fast. I would definitely encourage anyone who has been looking for a decent build system for JavaScript to give gulp some serious consideration. We were pleasantly surprised with the community support as well. There is already a wide array of community plugins for gulp that support many common use cases.

Re: Grunt and RequireJS are out, it's all about Gulp and Browserify

#17
post #14

One tiny benefit of Gulp - Grunt wasn't packaged on Debian because of JSHint which relied on JSLint which had the "The Software shall be used for Good, not Evil." licence clause http://en.wikipedia.org/wiki/JSLint

The people in that Debian thread[1] completely misunderstand how Node packages work - the 'jshint' dependency is in the 'devDependencies' section of the package, which means it is not installed by default when `npm install --production` is used, which is how it should be packaged in the first place.

Refusing to package Grunt for Debian because it has a devDependency on JSHint is like saying that Node can't be packaged because one of the contributors used a non-free IDE to develop it. No actual non-free software is distributed as part of the code.

Regardless, it's not a big deal to `apt-get install nodejs; npm install -g grunt`.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=673727

Additionally, I'd like to take this moment to remark that dcrockford is being completely pigheaded by not removing the "for good, not evil" part of the license of JSLint. It is completely divorced from reality and detrimental to free software in general. I understand that he thinks he is being an idealist, but there are better ways to promote doing good in the world than assuming that somehow, somewhere, evil-doers are writing evil Javascript (and they would get away with it too!) if only they weren't blocked by your license and could lint their code.

Re: Grunt and RequireJS are out, it's all about Gulp and Browserify

#18
post #6

I wouldn't say that. RequireJS vs. Browserify is still a very contentious issue that is up to a developer's preferences.

Is it really, though? Aside from RequireJS's subjectively awful syntax (I have built a few non-trivial applications with it, and find it generally very noisy) - it simply does not do many of the very useful things that Browserify does. Browserify is much more than just a simple dependency management toolkit, it allows you to easily write node-style code and use npm dependencies in the browser. It's practically apples and oranges.

Re: Grunt and RequireJS are out, it's all about Gulp and Browserify

#19
post #9

Earlier quoted context omitted.

I think the author oversimplified the choice of Browserify and RequireJS. They have some overlap, but are not 100% replacements. Both have the concept of modules, and they overlap in this area. Browserify allows you to use Node style modules in the browser. RequireJS allows you to asynchronously load parts of your app, while Browserify bundles all JS into a single file.

To further clarify, RequireJS also allows you to bundle all JS into a single file via the r.js build step. If you're planning on going that route with RequireJS, you should also look into AlmondJS: https://github.com/jrburke/almond

If you do end up using RequireJS, using r.js is practically a requirement. Declaring asynchronous dependencies in a production build is murder for performance.

Grunt's grunt-contrib-requirejs[1] does a good job of traversing your dependency graph with r.js and building out a single bundle, but it is not especially quick; it takes about a full 3-5s on my current build. But it's a hell of a lot better than the alternative.

Of course, if I were to start over, I'd run browserify and either build the files in a build step with Grunt or Gulp, or just use browserify-middleware[2] and skip the build step entirely (with something like node-sass for styles).

[1] https://github.com/gruntjs/grunt-contrib-requirejs [2] https://github.com/ForbesLindesay/browserify-middleware

Post reply on HN