Running Gulp.js in the background (OS X)

I discovered (or really just stopped ignoring references to) Gulp.js today and decided to give it a go. Now, this is not a post about what Gulp.js is - I'm assuming if you are reading this, you already know. This is about how to make me actually use it. The problem I ran into with Gulp right away was when you run it in a project in the terminal (`gulp`) with a gulpscript.js that watches certain folders (css,js, etc.), it has to just keep running in a terminal window in order to keep "watching" these folders. Even if you run the command with NOHUP to allow it to run in the background and free up the terminal session, you still have to remember to start it up for each project you're working on.

I couldn't find any solution for this (really?, am I really that horrible at searching Google? - there's gotta be something), so here's my little solution:

Open Automator

Create a new Application

Use the Run Shell Script action

Use /bin/bash as the shell

Copy the following into the script window, editing it for your project and duplicating for each project that Gulp is set up to watch:

Add the Application to Login Items for your user in System Preferences | Users & Groups

*Don't ask me about the inclusion of both nohup and trap "" HUP. I don't know why I needed both, but it made it work.*

In addition, I created two scripts in /usr/local/bin: `gulpstart.sh`, which includes the same commands as above, and `gulpstop.sh`, which consists of:

#/bin/bash
​killall gulp

This is useful if you just want to kill all of the gulp processes at once if you've added more projects and need to restart the "app" or for whatever reason. I haven't run into any issues with this so far (in all of an hour of using it), but if there's a better way, I'd love to hear it.