You don’t need Grunt

Mar 30, 2016 · 2 min read

Don’t get me wrong, grunt (and his little cousin gulp) are great tool, with them it has been made possible to ease development and deployment of (nearly) every recent application, in just a matter of configuration copy-pasting and variable replacing, your project build setup is ready. In fact it’s so easy that we don’t remember how we were doing before. Let me tell you.

No need to beat around the bush, because you already know it, we were building our project manually, by running a bash script who takes care of each and ever step, and voilà, project is ready to be deployed. So, what?

I will not ask you to move back to bash scripts, because we want benefits of both worlds, speed of bash scripts and flexibility of grunt. So let’s leave frontend wonderland to land in unix hell (just kinding). Here we are. What do you see? … I see Makefiles.

Compiling CSS files

Following grunt config is a bit verbose but still easy to understand:

On the other hand here is Makefile’s version:

Principal benefit from this method, other than simplicity, is speed, because lessc is a C++ library compiling CSS more than 10 times faster than its node equivalent.

Watch for changes

One of my favorite feature is to be able to watch files for change:

Using node watchy we can achieve the same result:

An awesome feature of Makefiles is to be able to invoke “css” target using “make css” inside the watch, DRY code.

Live reloading files

Live reload your files can help to improve productivity, you can enable it in Grunt with:

Using Make:

Concatenate and Uglify Javascript files

For this one I recommend using Grunt, it makes life much easier sometimes :)

One more thing about Makefiles

You might want to use a different configuration on production. To have environment dependent variables in your build setup. It’s possible to achieve this with following Makefile:

It’s now possible to overwrite “SERVER_URL” easily on production:

$ make echo_server
$ export SERVER_URL=''
$ make echo_server

To conclude, we should not drop Grunt in every project in favor of Makefiles, but let be true with ourself and agree that a good old Makefile is sometimes the best choice when starting a small project.


Thanks for reading.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store