Skip to content

Instantly share code, notes, and snippets.

@zachwolf
Last active August 29, 2015 13:56
Show Gist options
  • Save zachwolf/8795734 to your computer and use it in GitHub Desktop.
Save zachwolf/8795734 to your computer and use it in GitHub Desktop.
Listen for input during a grunt watch task
var spawn = require('child_process').spawn;
module.exports = function(grunt) {
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) {
data = (data + '').trim().toLowerCase();
if (data === "test") {
console.log("-------------------------------------------------");
console.log("test!");
console.log("-------------------------------------------------");
}
// log todos
if (data === "todos") {
spawn('grunt', ['todos'], { stdio: 'inherit'});
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment