diff --git a/README.md b/README.md index 7c2b9748..7cf0a229 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ Config: * demoConfig: `String` The path to the demo config file. Default: `demos/src/config.json` * updateorigami: `Boolean` The `demos` property of your `origami.json` file will be updated - to list the demo files that have been created. * runServer: `Boolean` Whether you want to run a local server or not. If true, it also sets 'local' to true. Default: `false` +* livereload: `Boolean` Will enable livereload on `runServer`. Default: `true` Runs: diff --git a/lib/origami-build-tools-cli.js b/lib/origami-build-tools-cli.js index 49c4b135..2b046a6f 100755 --- a/lib/origami-build-tools-cli.js +++ b/lib/origami-build-tools-cli.js @@ -66,8 +66,7 @@ var watch = !!argv.watch, function reportTaskError(error) { if (Array.isArray(error)) { log.primaryError(error.join('\n')); - } - if (error) { + } else if (error) { log.primaryError(error); } process.exit(1); diff --git a/lib/tasks/demo.js b/lib/tasks/demo.js index e94955c9..4d9de6ec 100644 --- a/lib/tasks/demo.js +++ b/lib/tasks/demo.js @@ -289,7 +289,7 @@ module.exports = function(gulp, config) { if (config.runServer) { promise = promise.then(function() { - module.exports.runServer(gulp); + module.exports.runServer(gulp, config); }); } @@ -301,24 +301,29 @@ module.exports = function(gulp, config) { } }; -module.exports.runServer = function(gulp) { +module.exports.runServer = function(gulp, config) { return new Promise(function(resolve, reject) { portfinder.getPort(function (err, port) { if (err) { reject(err); return; } + if (server) { resolve(server); return; } + + config = config || {}; + log.primary('Open http://localhost:'+port+'/demos/local/ in a browser to view the demos'); + server = gulp.src('.') .pipe(webserver({ directoryListing: true, port: port, host: '0.0.0.0', - livereload: true + livereload: (config.livereload === false || config.livereload === 'false') ? false : true })); resolve(server); }); diff --git a/lib/tasks/install.js b/lib/tasks/install.js index 13eb5513..f7d7bb0c 100644 --- a/lib/tasks/install.js +++ b/lib/tasks/install.js @@ -273,8 +273,7 @@ module.exports.runBowerInstall = function(config) { resolve(); }, function(output) { outputInstalling(configContainsOrigamiRegistry); - cliFailed(output); - reject(); + reject(cliFailed(output)); }); }); } else {