summaryrefslogtreecommitdiffstats
path: root/lib/cli/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cli/serve.js')
-rw-r--r--lib/cli/serve.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/cli/serve.js b/lib/cli/serve.js
index 9d53408..e2012e4 100644
--- a/lib/cli/serve.js
+++ b/lib/cli/serve.js
@@ -32,7 +32,9 @@ function generateBook(args, kwargs) {
var outputFolder = getOutputFolder(args);
var book = getBook(args, kwargs);
var Generator = Output.getGenerator(kwargs.format);
- var hasLiveReloading = kwargs['watch'];
+
+ var hasWatch = kwargs['watch'];
+ var hasLiveReloading = kwargs['live'];
// Stop server if running
if (server.isRunning()) console.log('Stopping server');
@@ -59,7 +61,7 @@ function generateBook(args, kwargs) {
.then(function() {
console.log('Serving book on http://localhost:'+port);
- if (lrPath) {
+ if (lrPath && hasLiveReloading) {
// trigger livereload
lrServer.changed({
body: {
@@ -69,7 +71,7 @@ function generateBook(args, kwargs) {
}
})
.then(function() {
- if (!hasLiveReloading) {
+ if (!hasWatch) {
return waitForCtrlC();
}
@@ -103,16 +105,22 @@ module.exports = {
description: 'Enable file watcher and live reloading',
defaults: true
},
+ {
+ name: 'live',
+ description: 'Enable live reloading',
+ defaults: true
+ },
options.log,
options.format
],
exec: function(args, kwargs) {
server = new Server();
var hasWatch = kwargs['watch'];
+ var hasLiveReloading = kwargs['live'];
return Promise()
.then(function() {
- if (!hasWatch) {
+ if (!hasWatch || !hasLiveReloading) {
return;
}