For the last few years, Gulp has been my go-to task runner for Node projects
and, generally, anywhere where I need to build things or run tasks. But the
recent release of Gulp 4 broke all of my config files and left me with hours of
frustrating rewrites, I decided to see what else might be out there. And,
naturally, I landed on Grunt.
One thing I liked about Gulp (prior to 4.0) was it’s much looser structure that
allowed a lot of freedom in how you structured your file. Grunt seems to be much
more structured and opinionated. And sometimes, I don’t like those opinions.
A prime example of this is grunt-contrib-watch
. When I type grunt watch
, I
want to run a series of setup tasks first before firing the watcher up. But
grunt-contrib-watch
squats on the prime real estate that is the watch
command.
But I wanted to use that command. And there doesn’t seem to be any way to just
say “run these arbitrary tasks before starting the watcher.” At least not one
that I could find clearly documented. Sure, I could just make my own mywatch
or similar command, but I’m picky. I want my command, so we need a way to rename
it.