How to use the browser-sync function in browser-sync

To help you get started, we’ve selected a few browser-sync 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 cncf / landscapeapp / tools / ciServer.js View on Github external
// This file configures a web server for testing the production build
// on your local machine.

import path from 'path';
import browserSync from 'browser-sync';
import historyApiFallback from 'connect-history-api-fallback';
import {chalkProcessing} from './chalkConfig';
import { projectPath } from './settings';

/* eslint-disable no-console */


console.log(chalkProcessing('running a dist server on http://localhost:4000 ...'));
// Run Browsersync
const result = browserSync({
  port: 4000,
  ui: {
    port: 4001
  },
  open: false,
  server: {
    baseDir: path.resolve(projectPath, 'dist')
  },
  files: [
    'src/*.html'
  ],
  ghostMode: false,
  middleware: [
    function (req, res, next) {

      const contentPath = path.resolve(projectPath, 'dist', 'prerender.html');
github jahrlin / isomorphic-flux-react-react-router / gulpfile.babel.js View on Github external
gulp.task('browsersync', cb => {
  browserSync({
    logPrefix: 'VRT',
    notify: false,
    https: false,
    proxy: 'localhost:3000'
  }, cb);

  process.on('exit', () => browserSync.exit());
});
github morlay / react-pure-mdl / gulpfile.babel.js / tasks / server.js View on Github external
return new Promise((resolve, reject) => {
    browserSync(taskConf, (err, bs) => {
      if (err) {
        return reject();
      }
      return resolve(bs);
    });
  });
}
github mirabeau-nl / frontend-boilerplate / tasks / browsersync.js View on Github external
function setupBrowserSync() {
  return browsersync(config)
}
github aurelia / cli / lib / resources / tasks / serve.js View on Github external
done => {
    browserSync({
      online: false,
      open: false,
      port: 9000,
      server: {
        baseDir: ['.'],
        middleware: function(req, res, next) {
          res.setHeader('Access-Control-Allow-Origin', '*');
          next();
        }
      }
    }, done);
  }
);
github callmecavs / bricks.js / gulpfile.babel.js View on Github external
gulp.task('server', () => sync(options))
github topheman / vanilla-es6-jspm / gulp / tasks / server.js View on Github external
break;
    }
    injectBrowserSync.push('');
    injectBrowserSync.push(bsHtmlSnippet);
    injectBrowserSync = injectBrowserSync.join('\n');
    config.rewriteRules = [
      {
        match: //g,
        fn: function (match) {
          return injectBrowserSync;
        }
      }
    ];
  }

  browserSync(config);
}
github bannertime / generator-bannertime / src / app / templates / gulpfile.babel.js / tasks / browserSync.js View on Github external
Gulp.task('browserSync', () => {
  return BrowserSync(config.tasks.browserSync);
});