Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
introducing ./task.js, THE new javascript task runner automation framework

why ./task.js?

One word: task automation. It's basically zero effort and you can use the ./task.js package manager to handle any repetitive tasks. You can use ./task.js to automate everything with minimum effort.

./task.js provides the structure, order, and authority that you as a developer so desperately crave. ./task.js will also take responsibility for your actions if you need it to. It's what everybody is using now. ./task.js is the new hotness. It's all about ./task.js now, just like that.

This is compared to npm run/bash scripts, which are:

  • scary
  • not cross-platformant for deploying to windows server 2003
  • old news. Nobody uses bash these days.

getting started

To install ./task.js, first install node.js.

Now you'll need to generate some scaffolding for your project.

You can use the following scaffold generator:

#!/usr/bin/env node
var fs = require('fs');
fs.writeFile('task.js', '#!/usr/bin/env node\n', { mode: 0775 });

browser code goes in browser/, stylesheets go in style/, static assets go in static/. You are free to change these directory names to be whatever you want. Just modify the scaffold generator.

Now you can get started writing your ./task.js script. Here is an example script that uses the browserify, watchify, and catw plugins published to the ./task.js plugin repository:

#!/usr/bin/env node

var fs = require('fs');
var browserify = require('browserify');
var watchify = require('watchify');
var catw = require('catw');

var cmd = process.argv[2];
if (cmd === 'build') build({ watch: false })
else if (cmd === 'watch') build({ watch: true })
else usage(1)

function build (opts) {
  var js = ? watchify : browserify;
  var css = catw('style/*.css', { watch: });
  css.on('stream', function (stream) {

function usage (code) {
  console.error('usage: ./task.js { build | watch }');
  if (code) process.exit(code);


To install ./task.js, first install node.js.

Copy link

NamelessCoder commented Jan 8, 2014

Please make a bash plugin.

Copy link

pvorb commented Jan 8, 2014

@jamwaffles: Grunt is for all lovers of huge monolithic frameworks like jQuery. ./task.js is better cause you decide what it does and how it behaves. It is immediately understood by every programmer who knows Node.js. You can achieve the same without having to learn anything new. It's pointless to tie oneself to a framework that has only the benefit of needing a plugin for each and every feature one needs. Use modular code, not frameworks. That's the Unix way.

@substack: You can't simply call ./task.js from a CMD prompt on any Windows version, btw. So it's not cross-platform either. :(

Copy link

donaldpipowitch commented Jan 8, 2014

I think every new JS developer would benefit from your knowledge if you would write this in a non-ironic way. I don't want to rant - that is my honest opinion. How about writing examples of tasks with frameworks like grunt or gulp and without any frameworks side-by-side in a serious and well explained fashion? And maybe even with bash as an additional example? Truth is: Grunt plugins have a clear interface and good docs so that everybody can use them. New JS developers maybe don't know what ['browser','static','style'].forEach(fs.mkdir) does and so they use more bloated frameworks like Grunt even if they don't need them.

Copy link

millermedeiros commented Jan 8, 2014

@substack nailed it. Been saying the same thing ever since grunt got popular. Plugins suck, no need for propriety task runners:

Copy link

sindresorhus commented Jan 8, 2014


Copy link

alanhoff commented Jan 8, 2014

It doesn't run on IE7 :(

Copy link

idx3d commented Jan 8, 2014

Haha, its nice tool

Copy link

jasonpincin commented Jan 8, 2014

@pvorb +1 1st post. I laughed.

Copy link

rafaelrinaldi commented Jan 8, 2014


Copy link

jmeiss commented Jan 9, 2014

Ah ah love it!

Copy link

pvorb commented Jan 9, 2014

@jasonpincin nice to hear

Copy link

h2non commented Jan 9, 2014

Nobody uses bash these days? I feel myself like an old guy xD

Copy link

radum commented Jan 9, 2014

What, I was doing all this manually and now you are telling me you'll had this figured out and now got bored about it?!?!?!

Damn I need to stream the news more often so I can keep up.

Copy link

timkock commented Jan 9, 2014

lolz, for a moment I thought not another %&^%#$%@$# task runner :P

Copy link

poeticninja commented Jan 9, 2014


Copy link

shama commented Jan 10, 2014

Needs more holy war. You forgot to include a style guide.

Copy link

yocontra commented Jan 10, 2014

Missing an example that isn't just concating files

Copy link

spencercarnage commented Jan 10, 2014

Needs more auto-magic.

Copy link

cowboy commented Jan 10, 2014

but how does it jquery

Copy link

adambiggs commented Jan 10, 2014

Eww, don't make me write code! I got into coding so I could learn to write config!

Copy link

raffi-minassian commented Jan 13, 2014


Copy link

nicovalencia commented Jan 16, 2014

👍 I lol'd

Copy link

shanestillwell commented Jan 20, 2014

Sorry, this task automator will NEVER take off until it has a cool logo. I'll need to get some stickers too before I even give this a look.

Copy link

mciparelli commented Jan 25, 2014

Please, let the community choose their own THE.

Copy link

mciparelli commented Jan 25, 2014

I'd agree with you if you just stick to write the (GREAT) packages you frequently write for the community instead of just this kind of gists which demonstrates that you are a person who thinks that the solutions you write are better than everyone else's. Even if the community agrees with that, Im not sure they will agree with your manners.

Copy link

BadOPCode commented Aug 3, 2014

WHAT IS THIS MADNESS?!?! Don't you know we should reinvent the wheel over and over because it makes our lives easier?
How about a library for reading JavaScript files in Node JS. I get so confused by 'require.' If they could just add about a dozen more steps to 'require' it would make it so much easier and more readable.
LOL I actually ended up here because I was trying to figure out what grandiose thing that these task runners are supposed to do that's better than just doing it yourself. Their mush mouth explanations and this gist tells me there is nothing great about them. In a weird way I got my answer.

Copy link

aluanhaddad commented Mar 6, 2015

I came across this and it made me smile. Thank you :)

Copy link

sthames42 commented Feb 18, 2016

Really?? I must have read the post four times thinking "where is the damn package to install?" and "how is this any different than writing it up yourself in Node scripts?" Seriously, I think the only thing missing from Node is GNU Make.

Copy link

balupton commented Mar 2, 2016

Not enough jQuery

Copy link

balupton commented Mar 2, 2016

For what it's worth, while I'm sure this isn't new... we do the same but call them Nakefiles:

We're probably going to simplify this further still and just go with npm scripts only: bevry/base#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment