I needed a way to issue notifications from gulp / node…

I always have a command line open so I can manually run my gulp tasks. For the project I work on the most at work, our gulp build (on a fast machine) takes around 6 seconds – we’re compiling TypeScript into JavaScript, transpiling that into ES5 compatible code, concatenating third-party scripts, compiling SASS into CSS, adding third-party stylesheets to that, etc. So I suppose 6 seconds isn’t too bad…

When making a tiny change to see if I fixed a bug, or to see a SASS mixin render in the browser, etc. – 6 seconds is a long time to wait until I can refresh my browser. And yes, I’ve tried browser sync – it doesn’t work with our set-up.

And, I found npm package “node-notifier” to be perfect. This allows you to issue an operating system level notification to say “Hey, gulp’s done! You can reload your browser now!”. Just tacking it onto the end of a gulp task seems to do the trick for me:

var notifier = require('node-notifier');

...Some code....

gulp.task('default', ['some-pre-built-dev-task'], function () {
        title: "Gulp is Done!",
        message: "Do whatever you need to do now!"

It’s helpful to have a predefined development task built, then make your default gulp task run it. After everything in that task is done, you’ll get a nice system level notification! There are more options like adding an icon to the notification – it’s a really great little package.

It’s the little things in life….