Remove the “grunt work” by making tasks repeatable & standardize build/deploy scenarios, win-win!
Now, I am sure many of the savvy techies in you would have already checked out Grunt/Gulp and using them in your own ways. Task Runners have been in the wild for some time now, with excellent tutorials to get you started & so I will not delve into the details of how/what/why of these items.
The point of this article is for an interesting thought I had:
- Is there any real need for such a framework(s) in your code in the first place?
- Aren’t we introducing additional components + complexity into our code by having such items?
Is there an alternative to get the automation benefits of Task Runners, without the need for additional complexity and/or bloat of adding such frameworks into your code?
When this thought occurred to me late last night (yes, during a New Year’s Eve Party & yes – I am THAT kind of nerd!), I just could not wait to get started & give it a twirl in the NPM world & see where I get to.
More specifically, I was thinking of code along the lines of:
// code in package.json
"build": "npm build:script && npm build:css && npm:deploy",
"build:script": "browserify src/index.js -o dist/lib.js",
As soon as I started along these lines, a small voice in my head went:
did someone think of such a solution before & if yes, what does that code look like?
Answer: Google says someone already has got there first.
I would strongly recommend to read through his material before continuing.
My personal opinion is that he is on to something here & I do see all the benefits in the solution.
Question: will I use the proposed solution in my own code-base?
Answer: While I really like the solution, is it worth the cost of readability for someone to “get” what it really stands for? I don’t know.
I will let this one simmer for a while & eventually wean off Grunting/Gulping.
I am too much in habit at this point in time.