Skip to content

Commit

Permalink
Rebuild on exit to remove live reload script
Browse files Browse the repository at this point in the history
  • Loading branch information
drawveloper committed Jan 31, 2016
1 parent 191a4e2 commit c21e765
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion bin/cleaver
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ var Cleaver = require('../');
* Helper function to use the cleaver API to create and save a new
* presentation
*/
function createAndSave(files, options) {
function createAndSave(files, options, done) {
if (!done) {
done = function(){};
}

files.forEach(function (file) {
fs.readFile(file, 'utf-8', function (err, contents) {
if (err) {
Expand All @@ -25,6 +29,7 @@ function createAndSave(files, options) {
.then(function (product) {
var outputFile = presentation.options.output || path.basename(file, '.md') + '-cleaver.html';
fs.writeFile(outputFile, product);
done();
})
.fail(function (err) {
process.stderr.write('!! ' + err.message + '\n');
Expand Down Expand Up @@ -94,6 +99,14 @@ program
tinylr.changed(file);
});
}

process.on('SIGINT', function () {
console.log('\nRebuilding without watch mode: ' + new Date());
options.watch = false;
createAndSave([file], options, function() {
process.exit();
});
});
});


Expand Down

0 comments on commit c21e765

Please sign in to comment.