I just released my very first Grunt plugin – and npm package – that searches a codebase and logs the findings.
Errr… what’s Grunt?
Grunt is the best thing since… you name it. It’s a build tool that allows web developers to run whatever “grunt” tasks they need, like minifying JS or CSS, Sass generation, file bundling, file renaming, moving, etc. etc. Basically it’s a one-stop shop for all those nagging things you need to do when deploying a site. I’ve been using it for various recent personal projects (generatedata.com, birdsearch.org) and for my day job. But one particular piece of functionality I found I couldn’t do, was a simple search-and-log.
There are a bunch of search-and-replace Grunt plugins out there, but for my job at the CBC, we needed something simpler for logging purposes only. We wanted to run various tests on our codebase to look for certain things: inline styles, inline event handlers, old, unwanted HTML tags, etc. None of these weren’t significant enough to warrant failing the build, but they do give a clue as the health of the codebase.
So basically, we run this function along with jshint in our dev environments to warn us about the accumulation of crap.
It’s fairly well documented, and can be downloaded via npm:
The source code is all found on github: