3 ms·
Personally, I think using NPM is more idiomatic; Both Grunt and NPM are third-party tools, however NPM is FAR more pervasive with Node than grunt is. Essentiall
by bitcrusher 13y ago
Personally, I think using NPM is more idiomatic; Both Grunt and NPM are third-party tools, however NPM is FAR more pervasive with Node than grunt is. Essentially, if you write Node, you use NPM. Not so with grunt.
- cmbaus 13y agoTo be honest, I didn't realize that npm could be used as a task runner, but now that I do, I'm wondering what all the fuss about Grunt is. Why bring in yet another meta-tool into the chain if npm (which is basically a requirement) can handle task execution already?
- redidas 13y agoI'm not entirely sure about this, but it seemed like Grunt was more for front-end developers that haven't quite jumped into Node.js yet (or had no intention to). I've noticed some culture differences between front-end and back-end javascripters.
- herokusaki 13y ago> I've noticed some culture differences between front-end and back-end javascripters. Could you elaborate on those?
- akbar501 13y ago> it seemed like Grunt was more for front-end developers Grunt is a task runner. It's a general purpose utility, that happens to work well with JavaScript (client and server). Our team first started using Grunt to concat Scala templates prior to compilation (in an old version of Play with an old JVM). Back then, we noticed that concatenating the Scala files reduced the amount of heap used during compilation. Never did figure out why. Later, we started to use Grunt to minify and concat our Backbone code. Currently, we use Grunt for both our server-side Node and client-side Angular. Server-side we use Grunt to: 1.) Restart Node on file change, 2.) Run JSHint against both server-side and client-side JavaScript, 3.) Set some environment vars prior to starting Node, plus a few other small tasks. Client-side we use Grunt to: 1.) Create a production build by minifying and concatenating JS, 2.) Minifying and concatenating CSS, Minifying HTML, plus some other minor tasks. We also use Grunt to run the client and server test suite. Basically, it's common practice to use Grunt (or Gulp, or another task runner) to assist with both client and server-side JS.