Playing with Yeoman and Grunt

29 Apr 2015 - tech

I’m a very old-fashioned developer and I’ve been staying away from grunt, gulp, yeoman and other JavaScript tools. As a sysadmin, the entire Node.JS ecosystem, frankly, terrifies me. When the recommended install method for your language is to download a shell script from the internet and run it via curl, well, it isn’t going to sit well with me.

I know I can extract what needs to happen from that script and run it myself, that’s what I actually do. However, that isn’t really part of the documentation. This leads to a larger debate of languages that move fast and how to handle package management tools that move fast as well. I don’t have a solution and I don’t want to get into that argument in any case.

This week, I had some free time and I played around with Yeoman and Grunt. The goal was to see how the developer workflow would look like. I’ve been wanting to write some better tooling for my Jekyll blog and never got around to it. Right now I use Fabric for all my automation and that’s about it. I’m looking to modernize it with bower and combine and minify the CSS and JS. But, first I wanted to try it out.

Merely out of curiosity, I built my seizure tracker. It’s just a web app (that currently uses client-side js) that shows days and hours since my last seizure. It can definitely be better, but the point wasn’t to build it but to test the workflow.

Installing things in node.js is painful. A lot of apps want to be installed globally. I refuse to install them with sudo, so I end up setting a custom prefix that’ll install them to a folder in my home directory. And to top it off, npm install gives me very little insight into what it’s actually doing while consuming a reasonable amount of CPU and RAM.

I like bower. It makes it easy to install and update a lot of the dependencies and generate the bower.json based on what I’ve installed. I tested a few countdown libraries and ended up not using a library at the end, because it was side tracking me from my goal of playing with the tools. Since I used generator-webapp, it setup a few grunt tasks for me. grunt serve is gorgeous. I love how it refreshes the page on the browser when I save the page. I finally understand what all the hipsters have been raving about! The internet tells me though that I should try gulp instead.

Quick look through the ecosystem, I like what I see. In the next few days I will probably be working with Gulp and bower to update the tooling around my blog so I can serve it even faster than right now!