Live data from Hacker News

Why I Left Gulp and Grunt for Npm Scripts

medium.com

51–60 of 75 posts

Re: Why I Left Gulp and Grunt for Npm Scripts

#51
That title I would call sensationalist. Our tooling choices don't have to take this king-of-the-molehill, all or nothing, "did X just kill Y?" extreme stance. (I thought the article made some reasonable points, though.)

With so much conflicting wisdom to sort through - "yuck, monolith!", "omakase!", "YAGNI!", "not enough abstraction!", "too much abstraction!" - we should admit that we often end up leaning on instinct/emotion when making these decisions.

Just remember that you don't have to pick one philosophy and stick with it for all time exclusively. Often down the road you'll see the value in something you thought you had sworn off.

Re: Why I Left Gulp and Grunt for Npm Scripts

#52

This. A thousand times this. Embrace the unix philosophy of small tools and npm scripts and watch your baroque frontend build process with all its plugin dependencies reduce to amazing simplicity. Here's another good write up with some significantly more useful examples: http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool... > Package.json also doesn’t support variables Not sure what he means by this, npm sc…

Gulp does embrace the unix philosophy of small tools and piping output.

Unfortunately it embraces it so much that there are several different variations of connecting the parts together, and even then some important tools don't play very nicely with the rest of the Gulp framework.

Consequently, it takes several lines of awkward boilerplate just to run a simple Browserify job that is a one-liner at the CLI. I've also seen Gulp adapters for popular tools, such as ESLint, that break suddenly when something apparently unrelated in the NPM set-up is updated, even though ESLint itself also still runs just fine with a one-liner at the CLI.

In fact, those were the two examples I used when I put my foot down over build tools on one project I work on a little while back. Within 20 minutes we'd replaced well over 100 lines of Gulp code with about 10 one-liner CLI jobs that did all of the same things. The new version has the added advantages of actually working, which the Gulp-based code used to but didn't any more, and of requiring a total of 0 changes since then to remain working, other than when the tools themselves changed their interfaces.

Re: Why I Left Gulp and Grunt for Npm Scripts

#53
post #35

I may not have been in the node and npm space long enough to fully understand the point of this, but it sounds like the endless argument of "stop using jQuery and go with raw Javascript instead". The argument goes that modern Javascript has moved far enough along that a library like jQuery is not as necessary. But the majority of the examples I've seen of how to avoid jQuery means essentially coding your own custom v…

...it sounds like the endless argument of "stop using jQuery and go with raw Javascript instead".

I respectfully disagree.

Using jQuery is helpful because it makes things work reliably where raw JS sometimes runs into browser quirks, and because it makes the code for various common functionality cleaner and more concise.

The trouble with tools like Gulp in the current ecosystem is that while they were supposed to do something similar, in practice they often seem to have the opposite effect: they introduce quirks and instability even when the tools they are running work just fine, and they make things that should be simple one-liners take a bunch of boilerplate and actual thought to set up.

This argument of dropping Grunt/Gulp seems the same to me. "Don't use a pre-coded builder or task runner, just build it yourself".

But here your default assumption seems to be that this kind of tool is necessary, and that not using one is the active change.

Why do I need a task runner to automate running something like

    browserify src/main.js -o dest/main.js
or

    eslint --parser babel-eslint --plugin react src
at all? I used these exact examples a while back to argue for dropping Gulp from a project I work on, and at that point the Browserify logic in the Gulp file ran to nearly a dozen lines of boilerplate, which had been substantially changed at least twice since the start of the project, while the ESLint task had stopped working, for reasons that we never determined but which certainly didn't involve ESLint itself not working.

Re: Why I Left Gulp and Grunt for Npm Scripts

#54
post #23

I am so happy to have left the web back into native, just about when gulp, grunt, npm, yeoman and friends were picking up steam. It is not enough to jungle DOM libraries, CSS generation, JavaScript frameworks, browser compatibility headaches, one also needs to use the build tool of the day.

Makefiles still work!

That's not hip enough. Why use a solid technology that's been around for almost 40 years? Instead, you can use a flavor-of-the-month tool written in a language originally designed for doing form validation and pre-loading rollover images of dancing kittens?

Re: Why I Left Gulp and Grunt for Npm Scripts

#55
post #45

Earlier quoted context omitted.

I seriously find this to be very implausible. Why? If they're already using gulp and have people in-house that understand gulp, why is it so unreasonable that they don't want their consultants adding a new build system to the mix?

Well, I was implying that those projects in question are greenfield not inherited ones but even in the case of inherited projects, I think that devs/consultants have bargaining power when negotiating contracts to work out a compromise when it comes to non core details of the project like build systems and the like and project owners or managers could accommodate the consultants' requests regarding these points.

A lot of consultants work with existing teams. As someone who has worked on such projects from the existing-team side, it would be very off-putting for the consultants to come in and demand to change this sort of trivia before they've contributed any value. Having said that, if they come in and contribute a ton, and then point out that they believe they and the rest of the team could be more productive by switching to such-and-such tool, then they will probably be listened to. Consultants don't come in with credibility, they earn it.

Re: Why I Left Gulp and Grunt for Npm Scripts

#56
post #35

I may not have been in the node and npm space long enough to fully understand the point of this, but it sounds like the endless argument of "stop using jQuery and go with raw Javascript instead". The argument goes that modern Javascript has moved far enough along that a library like jQuery is not as necessary. But the majority of the examples I've seen of how to avoid jQuery means essentially coding your own custom v…

It is nothing like that. Npm/node is the task runner and you are not doing anything yourself that you wouldn't have to do with grunt/gulp anyway. They are the equivalent of making a function like `add(a, b) { return a + b; }` instead of just using the `+` operator that is already there, it is nothing like jQuery vs "raw javascript".

Not that I disagree, but it seems you simplified things a bit much as compared to the subject at hand.

Plus, I've never heard of npm/node as being described as a task runner. I would appreciate an explanation as to what you mean by that.

Re: Why I Left Gulp and Grunt for Npm Scripts

#57
post #35

I may not have been in the node and npm space long enough to fully understand the point of this, but it sounds like the endless argument of "stop using jQuery and go with raw Javascript instead". The argument goes that modern Javascript has moved far enough along that a library like jQuery is not as necessary. But the majority of the examples I've seen of how to avoid jQuery means essentially coding your own custom v…

...it sounds like the endless argument of "stop using jQuery and go with raw Javascript instead". I respectfully disagree. Using jQuery is helpful because it makes things work reliably where raw JS sometimes runs into browser quirks, and because it makes the code for various common functionality cleaner and more concise. The trouble with tools like Gulp in the current ecosystem is that while they were supposed to do…

>> The trouble with tools like Gulp ...

I've heard similar arguments about jQuery as well. But are you saying there's a fundamental problem with gulp itself, or how people are using it?

As for your browserify example, keep in mind I'm not heavy into node/gulp at the moment, I would say that it is rather simplified as compared to what gulp actually offers. From my way of thinking your example only handles the single file, what happens when you complicate the matter a bit more? Do you end up recreating gulp in the end?

Re: Why I Left Gulp and Grunt for Npm Scripts

#58

Earlier quoted context omitted.

Makefiles still work!

That's not hip enough. Why use a solid technology that's been around for almost 40 years? Instead, you can use a flavor-of-the-month tool written in a language originally designed for doing form validation and pre-loading rollover images of dancing kittens?

[deleted]

Re: Why I Left Gulp and Grunt for Npm Scripts

#59
post #38

Earlier quoted context omitted.

We don't choose our tools, the customer's IT does it, so are the wonders of consulting when you work on existing projects. And they choose them, because they follow fashion.

Do your customers really dictate that you use grunt or gulp in your build process in their project? I seriously find this to be very implausible.

Why?

As already replied by other HNer, most of the projects are existing ones.

Our customers are the enterprise, not startups.

The consultants are expected to bring value within the customer's IT stack.

Usually even the dev environments are provided by IT, to be returned on project termination.

If the customer hires us to assess their stack and provide feedback on what to change, that is another matter.

Which still needs to be approved by their IT anyway.

Re: Why I Left Gulp and Grunt for Npm Scripts

#60
post #57

Earlier quoted context omitted.

...it sounds like the endless argument of "stop using jQuery and go with raw Javascript instead". I respectfully disagree. Using jQuery is helpful because it makes things work reliably where raw JS sometimes runs into browser quirks, and because it makes the code for various common functionality cleaner and more concise. The trouble with tools like Gulp in the current ecosystem is that while they were supposed to do…

>> The trouble with tools like Gulp ... I've heard similar arguments about jQuery as well. But are you saying there's a fundamental problem with gulp itself, or how people are using it? As for your browserify example, keep in mind I'm not heavy into node/gulp at the moment, I would say that it is rather simplified as compared to what gulp actually offers. From my way of thinking your example only handles the single f…

But are you saying there's a fundamental problem with gulp itself, or how people are using it?

As far as I can see, Gulp relies on plugins to be useful, and too many plugins for important tools seem to be either unstable or overly complicated.

The Gulp ecosystem is also a smaller illustration of the general Node/NPM culture problem that almost anything, no matter how simple, seems to get its own package to install. This very fine-grained packaging results in its own kind of dependency hell and a sort of artificially forced update schedule where updating one package to fix a bug or get some useful new feature has a knock-on effect that forces updates of numerous other things to remain compatible (or not, if those updates themselves break things or introduce new bugs).

From my way of thinking your example only handles the single file, what happens when you complicate the matter a bit more? Do you end up recreating gulp in the end?

Yes, that kind of command would be for a web app with a single entry point JS file generated from a single starting source file. But even that case, the simplest possible, requires a lot of boilerplate for no benefit at all in Gulp. Worse, the required boilerplate has changed several times within a year or two just to keep the Gulp infrastructure working.

I'm not sure what you have in mind for "when you complicate the matter", but I have yet to see an example related to Browserify that Gulp made any easier, even on projects with multiple targets each with their own starting point for building. So no, I don't see how any greater complexity I've encountered on a real project would wind up recreating a Gulp-like tool in the end (though of course that's just my own experience and doesn't mean no-one else has such a project).

Post reply on HN