Hacker News new | past | comments | ask | show | jobs | submit login
Grunt.js (gruntjs.com)
90 points by cleverjake on Sept 5, 2012 | hide | past | favorite | 24 comments



At Mozilla's PDF.js, we looked at several build alternatives in 2011. The main problem was that they all required a learning curve (they all looked like a domain-specific language), and sometimes they were too limited for our needs.

Since we already did everything through Makefiles, what we wanted was a shell script/Make that worked out of the box in all platforms (Windows included). So we wrote ShellJS for Node.js:

https://github.com/arturadib/shelljs

It is now battle-tested in several Mozilla projects (PDF.js, Firefox OS, Butter.js, etc). Check it out, happy to answer questions/comments at @arturadib.


ShellJS is awesome. It's basically Unix shell commands for Node.js, which is excellent if you want to write a makefile equivalent in JavaScript.

If, on the other hand, you want to execute web developer-centric tasks like concatenation and minification, linting, running of unit tests in pure JavaScript or a headless WebKit instance, or any of the functionality the 90+ plugins I'm aware of provide, check grunt out.

Grunt also works on all platforms, and supports completely arbitrary JavaScript tasks. If you can write it, grunt will execute it.

And because grunt supports arbitrary JavaScript tasks, you can use ShellJS (or any other JavaScript) from within grunt.


I created a build tool for similar reasons, difference being that it's aimed at Cakefile users. It's goal is to be as simples as possible, support common tasks out of the box (minifying, compiling LESS/coffee/etc) and should work on Windows too:

http://github.com/ricardobeat/cake-flour

I could see shelljs as a stand-alone executable using JSDB (http://jsdb.org) too, should be an easy port, cross-platform, much smaller and dependency-free.


With this sort of tool, I always have to ask myself: is it better than a Makefile?

https://github.com/mathquill/mathquill/blob/dev/Makefile

Yes, Makefiles don't have magic syntax for qunit, but they're incredibly flexible.


I've used both Makefiles and Grunt for projects and I much prefer Grunt:

* I find the js syntax of gruntfiles much cleaner and harmonious with the js code I'm writing for my projects

* From what I've seen, Makefiles are meant to create output files - seems like Grunt can be set up more easily for things meant for display (linting, etc)

* Better ecosystem with grunt plugins: https://github.com/cowboy/grunt/blob/master/docs/plugins.md


Agreed. And if you need cross-platform support (and the bonus of being JavaScript), try https://github.com/arturadib/shelljs


ShellJS looks great! Thank you.


Supposedly Yeomen is supposed to drop soon, which- I'm just guessing- is a bunch of inits and tasks built on Grunt to accomplish more. Yeomen is out of Google.



i can see the value of a build/automation tool written in js but man the resulting code is pretty ugly compared to a typical Rakefile


I don't get it.. are you posting this as news?

I'm pretty sure it's common knowledge, I'm one of those annoying node haters and I've known about it for months now.


Sorry.

This was posted for two reasons.

1 - I don't believe it is common knowledge. A lot of people know about it, but it is not quite reached the mainstream.

2 - They launched a new website.


Big node fan, hadn't seen this either. Side note, not criticising parent comment specifically, just thinking out loud: I still don't get why people question relevancy of submissions on sites like HN. Surely if its getting upvoted enough to hit the front page, the community finds value in it, right?


I didn't know about it. I'm sure I had never read about it anywhere, even on HN.


Not useful or common knowledge to you doesn't mean it's not useful or new for others. If you knew about it, and dislike it, what are you doing commenting here? If I had the same opinion I would have shrugged and told myself "Oh... grunt... again... Move along", not come in here to make a completely useless remark, which by the way obviously does not align with what the majority here thinks.


It was intended as a legit question. With such a descriptive title as "Grunt.js" on the submission.. it was kinda hard to tell.

Had it been "Grunt.js has a new website" I would have kept my fat mouth shut.


I'm an avid noder - and this is not common knowledge for me - but in fact great news!


I am currently using Brunch[1] as a build system.

How does grunt compare, and why should I switch?

[1]: http://brunch.io/


Hows it work on Windows? I use Windows, Mac, and Linux in pretty equal amounts so I need a build system that works on all 3.


Try ShellJS. It works on all three platforms, and has been battle-tested in the build systems of several Mozilla projects (PDF.js, Firefox OS, Popcorn.js, etc).

https://github.com/arturadib/shelljs


Sweet! I was just looking for a cross platform build tool but this seems like it can be useful in many other ways.


Haven't used it myself, but it is suppsoed to work, there are a number of Windows specific things on the FAQ - https://github.com/cowboy/grunt/blob/master/docs/faq.md


I run it in Windows via msysgit without issue (need nodejs and npm). It's pretty easy to get up and running quickly.


Grunt works great on all those platforms!




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: