Created
February 23, 2012 22:35
-
-
Save craftgear/1895416 to your computer and use it in GitHub Desktop.
jade watch
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
# run with 'coffee jadewatch.coffee dirname' | |
fs = require 'fs' | |
if process.argv.length < 3 | |
console.log 'Aborted: arguments are too short.' | |
return | |
else | |
child_process = require('child_process') | |
child_process.exec "ps", (err,stdout,stderr)-> | |
if stdout.indexOf("coffee jadewatch.coffee") < 0 | |
console.log "jade is watching " + process.argv[2] | |
fs.watchFile process.argv[2], {persistent:true, interval:500}, (curr, prev)-> | |
return if curr.size == prev.size && curr.mtime.getTime() == prev.mtime.getTime() | |
child_process.exec("jade " + process.argv[2], (err, stdout, stderr)-> | |
console.log stdout | |
console.log stderr | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment