Skip to content

Commit

Permalink
also watch and rebuild on --style included stylesheet change
Browse files Browse the repository at this point in the history
  • Loading branch information
gabeboning committed Jun 27, 2015
1 parent 53011dd commit 56f798a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bin/cleaver
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,23 @@ program
.description('Watch for changes on markdown file')
.action(function () {
var file = program.args[0];
createAndSave([file], getOptions());

var options = getOptions();
createAndSave([file], options);

console.log('Watching for changes on ' + file + '. Ctrl-C to abort.');
fs.watchFile(file, { persistent: true, interval: 100 }, function () {
console.log('Rebuilding: ' + new Date());
createAndSave([file], getOptions());
createAndSave([file], options);
});

// also watch on stylesheet if included via command prompt
if(options['style'] != undefined) {
fs.watchFile(options['style'], { persistent: true, interval: 100 }, function () {
console.log('Rebuilding: ' + new Date());
createAndSave([file], options);
});

}
});


Expand Down

0 comments on commit 56f798a

Please sign in to comment.