Browse Source

Added a simple tool to watch for changes in the source and automatically rebuild vis.js on changes

css_transitions
josdejong 11 years ago
parent
commit
f98bb4410c
1 changed files with 33 additions and 0 deletions
  1. +33
    -0
      tools/watch.js

+ 33
- 0
tools/watch.js View File

@ -0,0 +1,33 @@
/**
* Watch for changes in the sourcecode, and rebuild vis.js on change
*
* Usage:
* cd vis
* node tools/watch.js
*/
var watch = require('node-watch'),
child_process = require('child_process');
// constants
var WATCH_FOLDER = './src';
var BUILD_COMMAND = 'jake build';
// rebuilt vis.js on change of code
function rebuild() {
var start = +new Date();
child_process.exec(BUILD_COMMAND, function () {
var end = +new Date();
console.log('rebuilt in ' + (end - start) + ' ms');
});
}
// watch for changes in the code, rebuilt vis.js automatically
watch(WATCH_FOLDER, function(filename) {
console.log(filename, ' changed');
rebuild();
});
rebuild();
console.log('watching for changes in the source code...');

Loading…
Cancel
Save