Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable LiveReload #102

Open
hinell opened this issue Mar 8, 2020 · 1 comment
Open

Add option to disable LiveReload #102

hinell opened this issue Mar 8, 2020 · 1 comment

Comments

@hinell
Copy link

hinell commented Mar 8, 2020

Please, add option to disable live reloading. Thanks.

@LCarnovale
Copy link

In version 1.17.4 the command line method for disabling live reload does not seem to work well enough to stop a flurry of permission errors when the server is run in folders such as /home. I fixed this with a few changes in /usr/local/lib/node_modules/markserv/lib/server.js:

27-const promptly = require('promptly')
28-const isOnline = require('is-online')
29-
30-const pkg = require(path.join('..', 'package.json'))
31-
32:// CHANGE: Added:
33-const blockLiveReload = true;
34-
35-const style = {
36-     link: chalk.blueBright.underline.italic,
37-     github: chalk.blue.underline.italic,
--
532-            }
533-    }
534-}
535-
536-const startConnectApp = (liveReloadPort, httpRequestHandler) => {
537:        // CHANGE: New: (To allow blocking of live reload)
538-        if (blockLiveReload) {
539-            return connect().use('/', httpRequestHandler)
540-    } else {
541-            return connect().use('/', httpRequestHandler)
542-            .use(connectLiveReload({
543-                    port: liveReloadPort
544-            }))
545-    }
546:        // CHANGE: Old:
547-        /*
548-    return connect()
549-            .use(connectLiveReload({
550-                    port: liveReloadPort
551-            }))
552-            .use('/', httpRequestHandler)
553-        */
--
687-    const httpRequestHandler = createRequestHandler(flags)
688-    const connectApp = startConnectApp(liveReloadPort, httpRequestHandler)
689-    const httpServer = await startHTTPServer(connectApp, httpPort, flags)
690-
691-    let liveReloadServer
692:    // CHANGE: Old:
693-    // if (liveReloadPort && liveReloadPort !== 'false') {
694:        // CHANGE: New: (I don't want live reload!!)
695-    if (!blockLiveReload && (liveReloadPort && liveReloadPort !== 'false')) {
696-            liveReloadServer = await startLiveReloadServer(liveReloadPort, flags)
697-    }
698-
699-    const serveURL = 'http://' + flags.address + ':' + httpPort

Full file attached here: (Note this will probably download as a .txt file, .js files are not allowed to be attached)
server.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants