diff --git a/lib/commands/serve.js b/lib/commands/serve.js index 13de4b8..2d008bb 100644 --- a/lib/commands/serve.js +++ b/lib/commands/serve.js @@ -25,10 +25,26 @@ module.exports = function ( livereloadPort = p }) .then(_ => { - path = resolve(path || '.') - const indexFile = resolve(path, indexName || 'index.html') + const server = connect() + server.use( + livereload({ + port: livereloadPort + }) + ) + + let indexFileFound = false + let indexFile + path.split(',').forEach(path => { + path = resolve(path || ',') + indexFile = resolve(path, indexName || 'index.html') + if (exists(indexFile)) { + indexFileFound = true + } - if (!exists(indexFile)) { + server.use(serveStatic(path, {index: indexName})) + }) + + if (!indexFileFound) { const msg = '\nNo docs found ' + indexFile + @@ -39,13 +55,6 @@ module.exports = function ( process.exit(0) } - const server = connect() - server.use( - livereload({ - port: livereloadPort - }) - ) - server.use(serveStatic(path, {index: indexName})) server.listen(port) lrserver .createServer({ @@ -53,7 +62,7 @@ module.exports = function ( exclusions: ['node_modules/'], port: livereloadPort }) - .watch(path) + .watch(path.split(',')) if (openInBrowser) { open(`http://localhost:${port}`)