Apparently, someone misses Makefiles

|

I wrote a very thorough comment in response to the rather (unfortunately) ignorant and inflammatory blog post on DailyJS titled Static Site Generators for Yeoman, but it seems to have mysteriously disappeared. I didn’t intentionally delete it, at least.

Either way, here’s my original comment, in case you may have missed it.

My unedited, original comment

Yeoman and Grunt are two entirely different things. Yeoman scaffolds out a project. Grunt runs tasks. And Bower? That’s another thing altogether.

I can definitely understand how these projects often get lumped together, since most Yeoman generators create Gruntfiles as part of their scaffolding process, and many generators use Bower as a means of client-side dependency management. But just because a Yeoman generator creates a Gruntfile doesn’t mean the author of that generator knows how to write an optimal Gruntfile.

And just because these projects are often used in conjunction doesn’t mean any of these projects necessarily share the same goals. I mean, other than presumably “making people’s lives easier.”

Regarding your specific complaints, I’m not sure what you mean by “Idiomatic Node.” But it would be trivial for someone to write a Yeoman generator that conforms to Felix’s or Isaac’s or whoever’s code style guidelines. You could even be that person. I haven’t used Yeoman, but I assume they make it easy to author generators.

While Grunt can automate tasks, if you’re already comfortable doing all your automation in Make, by all means continue to do so. Just try to understand that a lot of effort has been put into Grunt to make it work cross-OS without much extra effort (being pure JS, it needs nothing other than Node.js and npm to work) as well as to create a standard way to configuring tasks (good luck parsing JSON in a Makefile or getting file globbing to work cross-OS). Not to mention that you can write your Gruntfile in JavaScript!

There’s a fairly robust Getting Started guide along with a Configuring Tasks guide over at gruntjs.com that should help you understand what you need to do to get going, if you’re coming from another tool, like Make.

From the README, the grunt-contrib-connect plugin was “designed to be used in conjunction with another task that is run immediately afterwards, like the grunt-contrib-qunit plugin qunit task.” The use-case? So unit tests can be run from http:// instead of file:// URLs, because I found that sometimes it mattered. By design, the server quits once Grunt finishes. But, based on community feedback, I added a “keepalive” parameter (also in the README). Problem solved?

If you’re just looking for static site generation, there’s actually a fairly promising looking project in the works called “assemble” by the LESS guys at http://assemble.io/ - I haven’t used it yet, but it has definitely piqued my interest.

Also, if you’d like to contribute to Grunt or discuss improvements, I’m all ears. If you’ve listened to the JavaScript Jabber podcast I was recently on, you’ll hear me very honestly admit that I’ve made a lot of mistakes and have learned a lot in the process, and am trying to continue to improve Grunt.

http://javascriptjabber.com/074-jsj-grunt-js-with-ben-alman/

So, why not come to #grunt on Freenode IRC, and say hi?

Thanks,

- Ben Alman
Author of Grunt

A sidenote about Make

This wasn’t in my initial comment, but in my experience, Make is very smartly built, and is a fantastic tool if you’re on one of the operating systems that natively supports it (and comes with the GNU or POSIX cli utilities likely to be used inside of a Makefile). If you’re on Windows, however, ramp-up time and compatibility issues can be a huge pain. Also, backslashes, anyone?

For those who say, “Make just works,” they never seem to include any of the caveats.

Post A Comment

  • Any of these HTML tags may be used for style: a, b, i, br, p, strong, em, pre, code.
  • Multi-line JavaScript code should be wrapped in <pre class="brush:js"></pre>
    (supported syntax highlighting brushes: js, css, php, plain, bash, ruby, html, xml)
  • Use &lt; instead of < and &gt; instead of > in the examples themselves.