Last active
August 29, 2015 13:56
-
-
Save zachwolf/8795734 to your computer and use it in GitHub Desktop.
Listen for input during a grunt watch task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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