|
|
|
|
@ -15,6 +15,17 @@ var fs = require('fs');
|
|
|
|
|
var path = require('path');
|
|
|
|
|
var child_process = require('child_process');
|
|
|
|
|
|
|
|
|
|
function printResults(err, stdout, stderr) {
|
|
|
|
|
if (err) return console.log(err);
|
|
|
|
|
if (stdout) console.log(stdout);
|
|
|
|
|
if (stderr) console.log(stderr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function compileLESS() {
|
|
|
|
|
child_process.exec('lessc --include-path=notebook/static --verbose notebook/static/style/style.less notebook/static/style/style.min.css', printResults);
|
|
|
|
|
child_process.exec('lessc --include-path=notebook/static --verbose notebook/static/style/ipython.less notebook/static/style/ipython.min.css', printResults);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function watchDir(dir) {
|
|
|
|
|
var rootPath = path.join(__dirname, '..');
|
|
|
|
|
var watchPath = path.resolve(dir);
|
|
|
|
|
@ -22,18 +33,10 @@ function watchDir(dir) {
|
|
|
|
|
fs.watch(watchPath, {recursive: true}, function(event, file) {
|
|
|
|
|
if (file && /.+\.less$/.test(file)) {
|
|
|
|
|
console.log('less-watch:', 'modified:', file);
|
|
|
|
|
child_process.exec('lessc --include-path=notebook/static --verbose notebook/static/style/style.less notebook/static/style/style.min.css', function(err, stdout, stderr) {
|
|
|
|
|
if (err) return console.log(err);
|
|
|
|
|
if (stdout) console.log(stdout);
|
|
|
|
|
if (stderr) console.log(stderr);
|
|
|
|
|
});
|
|
|
|
|
child_process.exec('lessc --include-path=notebook/static notebook/static/style/ipython.less notebook/static/style/ipython.min.css', function(err, stdout, stderr) {
|
|
|
|
|
if (err) return console.log(err);
|
|
|
|
|
if (stdout) console.log(stdout);
|
|
|
|
|
if (stderr) console.log(stderr);
|
|
|
|
|
});
|
|
|
|
|
compileLESS();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
compileLESS();
|
|
|
|
|
watchDir(process.argv[2]);
|
|
|
|
|
|