diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-10 13:14:32 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-05-10 13:14:32 +0200 |
commit | 1a13c8c9bb4dd388ba17a6b2f4931905815254ef (patch) | |
tree | b47e5349c9b5f49c2947a61f6c4c153fa7569176 /lib/cli | |
parent | 852fae3a099cc45c88a0b28b55a13d47644e53e4 (diff) | |
download | gitbook-1a13c8c9bb4dd388ba17a6b2f4931905815254ef.zip gitbook-1a13c8c9bb4dd388ba17a6b2f4931905815254ef.tar.gz gitbook-1a13c8c9bb4dd388ba17a6b2f4931905815254ef.tar.bz2 |
Add option "--no-live" for command serve
Diffstat (limited to 'lib/cli')
-rw-r--r-- | lib/cli/serve.js | 16 |
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; } |