How to use the browser-sync.init 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 nstungcom / gulp-starter-kit / gulpfile.babel.js View on Github external
function server (done) {
  browserSync.init({
    server: PATHS.dist, port: PORT, open: false
  }, done)
}
// Reload the browser with Browsersync
github 1ambda / kafka-connect-dashboard / kafkalot-ui / tools / ProdServer.js View on Github external
import browserSync from 'browser-sync'
import historyApiFallback from 'connect-history-api-fallback'

import { OUTPUT_DIR, } from './BuildConfig'

browserSync.init({
  port: 3000,
  ui: { port: 3001, },
  server: {
    baseDir: [ OUTPUT_DIR, ],
  },

  files: [ 'src/*.html', ],

  middleware: [
    historyApiFallback(),
  ],
})
github microsoft / vscode-samples / node-express-javascript / gulpfile.js View on Github external
gulp.task('browser-sync', ['nodemon', 'watch'], function () {
    browserSync.init(null, {
        proxy: "http://localhost:3000",
        files: ["public/**/*.*", "views/**/*.*"],
        port: 7000,
    });
});
github D34THWINGS / ng-redux-dev-tools / gulpfile.babel.js View on Github external
gulp.task('bs:init', function () {
  browserSync.init({
    server: {
      baseDir: 'example',
      routes: {
        '/dist': 'dist',
        '/node_modules': 'node_modules'
      }
    }
  });
});
github Shopify / polaris-tokens / gulpfile.js View on Github external
function serve(done) {
  browserSync.init({
    open: false,
    notify: false,
    server: 'docs',
  });
  done();
}
github rndsolutions / hawkcd / Server / ui / gulp / server.js View on Github external
var server = {
    baseDir: baseDir,
    routes: routes
  };

  /*
   * You can add a proxy to your backend by uncommenting the line below.
   * You just have to configure a context which will we redirected and the target url.
   * Example: $http.get('/users') requests will be automatically proxified.
   *
   * For more details and option, https://github.com/chimurai/http-proxy-middleware/blob/v0.9.0/README.md
   */
   server.middleware = proxyMiddleware('/', {target: 'http://localhost:8080', changeOrigin: true});

  browserSync.instance = browserSync.init({
    startPath: '/',
    server: server,
    browser: browser
  });
}
github aruss / IdentityBase / src / IdentityBase.Web / Plugins / DefaultTheme / gulpfile.js View on Github external
gulp.task('serve', ['build'], function () {

    browserSync.init(null, {
        proxy: "http://localhost:5000",
    });

    watchStyles();
    watchScripts();

    gulp.watch([
        './Views/**/*.cshtml',
        './wwwroot/js/**/*.min.js',
        './wwwroot/css/**/*.min.css'
    ]).on('change', browserSync.reload);
});
github jakemmarsh / react-rocket-boilerplate / gulp / tasks / browserSync.js View on Github external
gulp.task('browserSync', function() {

  const DEFAULT_FILE = 'index.html';
  const ASSET_EXTENSION_REGEX = new RegExp(`\\b(?!\\?)\\.(${config.assetExtensions.join('|')})\\b(?!\\.)`, 'i');

  browserSync.init({
    server: {
      baseDir: config.buildDir,
      middleware: function(req, res, next) {
        const fileHref = url.parse(req.url).href;

        if ( !ASSET_EXTENSION_REGEX.test(fileHref)) {
          req.url = '/' + DEFAULT_FILE;
        }

        return next();
      }
    },
    port: config.browserPort,
    ui: {
      port: config.UIPort
    },