How to use live-server - 10 common examples

To help you get started, we’ve selected a few live-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bradyhouse / house / fiddles / angular2 / fiddle-0044-GridStateRouting / live-server.js View on Github external
#!/usr/bin/env node

var liveServer = require("live-server");

var params = {
  port: 8080, // Set the server port. Defaults to 8080.
  host: "0.0.0.0", // Set the address to bind to. Defaults to 0.0.0.0 or process.env.IP.
  ignore: '*', // comma-separated string for paths to ignore
  file: "index.html", // When set, serve this file for every 404 (useful for single-page applications)
  wait: 1000, // Waits for all changes, before reloading. Defaults to 0 sec.
  logLevel: 2 // 0 = errors only, 1 = some, 2 = lots
};
liveServer.start(params);
github negokaz / vscode-live-server-preview / src / extension.ts View on Github external
vscode.window.showErrorMessage('Live Server Preview can preview only HTML file');
            return;
        }

        const workspacePath = 
            vscode.workspace.rootPath;
        const documentPath = 
            textEditor.document.uri.fsPath;

        const rootPath =
            // workspace is available and it has the document
            (workspacePath && documentPath.startsWith(workspacePath))
                ? workspacePath 
                : path.dirname(documentPath);

        const server = liveServer.start({
            port: 0, // random port
            host: '127.0.0.1',
            root: rootPath,
            open: false
        });

        // some/file.html
        const relativePath = documentPath.substr(rootPath.length + 1);
        
        const panel = vscode.window.createWebviewPanel(
            'extension.liveServerPreview',
            relativePath,
            vscode.ViewColumn.Two,
            {
                enableScripts: true
            }
github victronenergy / venus-html5-app / test / displays / test-server.js View on Github external
const liveServer = require("live-server")
const mockMQTT = require("../../fake-broker.js").MockMQQTBroker

const params = {
  port: 8002,
  root: "test/displays",
  watch: ["dist/", "test/displays"],
  mount: [["/dist", "./dist"]]
}

const mqtt = new mockMQTT(9002)
liveServer.start(params)
github ritwickdey / vscode-live-server / src / LiveServerHelper.ts View on Github external
setTimeout(() => {
            try {
                let ServerInstance = liveServer.start(params);
                setTimeout(() => {

                    if (!ServerInstance._connectionKey) {
                        return callback(null);
                    }

                    httpShutdown(ServerInstance)
                    return callback(ServerInstance);

                }, 1000);
            } catch (err) {
                console.error(err);
                callback(null);
            }

        }, 0);
github d3plus / d3plus-common / bin / examples.js View on Github external
${addSection("html", contents)}




`).to(filename);

    examples.push(filename);

  });

  log.timer("taking screenshots");
  server.start({logLevel: 0, noBrowser: true, port}).on("listening", () => {

    shell.rm("-rf", `../d3plus-website/_examples/${name}`);

    Promise.all(examples.map(ssPromise)).then(() => {

      screenshot.close();

      if (shell.test("-d", "../d3plus-website")) {
        log.timer("uploading examples to d3plus.org");
        shell.cd("../d3plus-website");
        shell.exec(`git add _examples/${name}/*`);
        shell.exec(`git commit -m \"${name} examples\"`);
        shell.exec("git push -q");
      }
      else {
        log.warn("d3plus-website repository folder not found in parent directory, builds cannot be uploaded to d3plus.org");
github michalsnik / aos / scripts / start-server.js View on Github external
const liveServer = require('live-server');

const params = {
  port: 8080,
  host: '0.0.0.0',
  root: './demo',
  watch: ['dist/**', 'demo/**'],
  open: process.env.NODE_ENV !== 'test',
  mount: [['/dist', './dist']],
  noCssInject: true
};

const server = liveServer.start(params);

module.exports = server;
github astronomersiva / lego / lib / tasks / startServer.js View on Github external
} else {
      require('../utils/generateSslCert')();

      httpsOptions = {
        cert: fs.readFileSync(CERT_FILE),
        key: fs.readFileSync(KEY_FILE)
      };
    }

    options = {
      ...options,
      https: httpsOptions
    };
  }

  liveServer.start(options);
}
github bradyhouse / house / fiddles / node / fiddle-0040-DropBoxSdk / main.js View on Github external
function startServer() {
  const params = {
    port: 5555,
    host: HOST_NAME,
    root: './',
    file: 'index.html',
    wait: 1000,
    logLevel: 2
  };
  liveServer.start(params);
}
github bradyhouse / house / fiddles / node / fiddle-0041-SvgWriter / main.js View on Github external
function startServer() {
  const params = {
    port: 5555,
    host: HOST_NAME,
    root: './',
    file: SVG_FILE_NAME,
    wait: 1000,
    logLevel: 2
  };
  liveServer.start(params);
}
github reimertz / lagom / src / bin / lagom-server.js View on Github external
export const server = () => {
  process.stdout.write(chalk.green('◩  lagom-server is running'))
  liveServer.start(params)
}

live-server

simple development http server with live reload capability

MIT
Latest version published 3 years ago

Package Health Score

55 / 100
Full package analysis

Popular live-server functions