Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: watch stylesheet if passed with --style arg and reload on stylesheet change #120

Merged
merged 5 commits into from
Jun 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ('style' in options) {
console.log('Also watching for changes on ' + options.style);
fs.watchFile(options.style, { persistent: true, interval: 100 }, function () {
console.log('Rebuilding: ' + new Date());
createAndSave([file], options);
});
}
});


Expand Down