Create a gist now

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.

pvorb commented Jan 8, 2014


Screw Gulp, which I learned yesterday! Screw Grunt, which I learned two weeks ago. Screw Make, which I learned 2 years ago. Screw Bash, which I could never learn.

This is the new hot shit!

Please create a cool HTML5 website with some scrolling effects and shit, so real developers can use it. It also has to list all modules that are supported and companies who are using it.

Everybody I know uses Windows Server 2003. It has the largest market share and is the most up to date server OS out there! Linux is just a blip on the horizon, and Grunt can fuck off because it totally doesn't have hundreds of packages for doing everything you'd want to do.

On a more serious note: why is ./task.js (stupid name) better than every other solution out there, particularly Grunt?

contra commented Jan 8, 2014

Pretty funny

vmakhaev commented Jan 8, 2014

TaskJS and VanillaJS are my favorite frameworks

kahlil commented Jan 8, 2014

😆 this is great!

Please make a bash plugin.

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. :(

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.

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


alanhoff commented Jan 8, 2014

It doesn't run on IE7 :(

id0x3d commented Jan 8, 2014

Haha, its nice tool

@pvorb +1 1st post. I laughed.

jmeiss commented Jan 9, 2014

Ah ah love it!

pvorb commented Jan 9, 2014

@jasonpincin nice to hear

h2non commented Jan 9, 2014

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

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.

timkock commented Jan 9, 2014

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

shama commented Jan 10, 2014

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

contra commented Jan 10, 2014

Missing an example that isn't just concating files

Needs more auto-magic.

cowboy commented Jan 10, 2014

but how does it jquery

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

👍 I lol'd

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.

Please, let the community choose their own THE.

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.

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.

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

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.

balupton commented Mar 2, 2016

Not enough jQuery

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