Created
January 28, 2014 01:44
-
-
Save webuniverseio/8660996 to your computer and use it in GitHub Desktop.
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
/*jshint strict:false*/ | |
/*global require:true, console:true, __dirname:true*/ | |
var path = require('path'), | |
exec = require('child_process').exec, | |
//developmentFilesPath - relative path from this file to source folder, don't add trailing splash | |
developmentFilesPath = '..', | |
watcher = require('watch-tree-maintained').watchTree(path.join(__dirname, developmentFilesPath), { | |
match : /\.(scss|js)$/g | |
}); | |
function handleProcessTermination(err, sysout, syserr) { | |
if (err) { | |
console.log(err + '\n'); | |
} | |
if (sysout) { | |
console.log(sysout + '\n'); | |
} | |
if (syserr) { | |
console.log(syserr + '\n'); | |
} | |
} | |
function runCommand(command) { | |
exec(command, handleProcessTermination).stdin.end(); | |
} | |
watcher.on('fileModified', function (path, stats) { | |
// if (~path.search(/\.scss$/)) { | |
// runCommand('compass compile'); | |
// } else | |
if (~path.search(/\.js$/) && !~path.search(/build-js\//)) { | |
runCommand('node app.build.js'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment