How to use the reload function from browser-sync

Find comprehensive JavaScript browser-sync.reload code examples handpicked from public code repositorys.

244
245
246
247
248
249
250
251
252
253
    .pipe(autoprefixer())
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('app/css'))
    // Reloading the stream
    .pipe(
      browserSync.reload({
        stream: true,
      })
    )
)
fork icon290
star icon350
watch icon14

109
110
111
112
113
114
115
116
117
118
    }
  });
}

function reload(cb) {
  browserSync.reload();
  if (cb) {
    cb();
  }
}
fork icon191
star icon0
watch icon48

23
24
25
26
27
28
29
30
31
32
    return serverInstance
}

const reload = () => {
    log.trace('Reloading BrowserSync')
    browserSync.reload()
}

module.exports = {
    start,
fork icon0
star icon4
watch icon2

15
16
17
18
19
20
21
22
23
24
25


const gulp = require('gulp');
const $ = require('gulp-load-plugins')();
const del = require('del');
const browserSync = require('browser-sync');
const reload = browserSync.reload;
const merge = require('merge-stream');
const path = require('path');
const workboxBuild = require('workbox-build');
const prettyBytes = require('pretty-bytes');
fork icon0
star icon1
watch icon0

26
27
28
29
30
31
32
33
34
35
  fs.mkdirSync(dir);
}

bs.watch(resumeFilename).on('change', () => {
  reBuildResume(theme, dir, resumeFilename, () => {
    bs.reload();
  });
});
reBuildResume(theme, dir, resumeFilename, () => {
  bs.init({
fork icon1
star icon0
watch icon0

+ 2 other calls in file

105
106
107
108
109
110
111
112
113
114
115
116
  gulp.watch("source/img/icon-*.svg", gulp.series("sprite", "html", "refresh"));
  gulp.watch("source/*.html", gulp.series("html", "refresh")).on("change", server.reload);
});


gulp.task("refresh", function (done) {
  server.reload();
  done();
});


gulp.task("start", gulp.series("css", "server"));
fork icon1
star icon0
watch icon0

12
13
14
15
16
17
18
19
20
21
22
23
var cachebust = require('gulp-cache-bust');
var changedInPlace = require('gulp-changed-in-place');
var gulpif = require('gulp-if');
var nop = require('gulp-nop');
var runSequence = require('run-sequence');
var reload = browserSync.reload;




var localization="en";

fork icon0
star icon0
watch icon2

+ 69 other calls in file

8
9
10
11
12
13
14
15
16
17
18
const nunjucks           = require('nunjucks');
const ComponentExtension = require('nunjucks-luego-component-extension');
const GetData            = require('luego-get-data');
const rimraf             = require('rimraf');
const browserSync        = require('browser-sync');
const reload             = browserSync.reload;


const fs                 = require('fs');
const path               = require('path');

fork icon0
star icon0
watch icon1

+ 4 other calls in file

11
12
13
14
15
16
17
18
19
20
21
22
var plumber = require('gulp-plumber')
var jswrap = require('gulp-js-wrapper')
var autoprefixer = require('gulp-autoprefixer')


var browserSync = require('browser-sync').create()
var reload = browserSync.reload


// LINT JS
gulp.task('lint', function () {
  return gulp.src('public/_js/*.js').pipe(jshint()).pipe(plumber()).pipe(jshint.reporter('default'))
fork icon0
star icon0
watch icon1

+ 20 other calls in file

108
109
110
111
112
113
114
115
116
117
118
119
      });
      done();
}


const browserReload = (done) => {
    browserSyncServer.reload();
    done();
}


/**
fork icon0
star icon0
watch icon1

+ 13 other calls in file

89
90
91
92
93
94
95
96
97
98
);

// Watch all my sass files and compile sass if a file changes.
watch(['./src/stories/global/base/**/*.json'],
  series(buildVariables, compileSass, concatCSS, (done) => {
    server.reload('*.css');
    done();
  })
)
watch(
fork icon0
star icon0
watch icon7

+ 19 other calls in file

10
11
12
13
14
15
16
17
18
19
20
const postcss      = require("gulp-postcss");
const tailwindcss  = require('tailwindcss');
const autoprefixer = require('autoprefixer');
const sass         = require('gulp-sass');
const browserSync  = require('browser-sync').create();
const reload       = browserSync.reload;


let emittyPug;
let errorHandler;

fork icon0
star icon0
watch icon1

+ 18 other calls in file

155
156
157
158
159
160
161
162
163
164

stream.on('end', () => {
  console.log(`[nunjucks] ${hasError ? bold(red('ERROR')) : bold(green('done'))} in ${(performance.now() - njkStartPerf).toFixed(0)}ms`);

  if (!hasError) {
    bsSP.reload();
  }

  done();
});
fork icon0
star icon0
watch icon0

+ 6 other calls in file

35
36
37
38
39
40
41
42
43
44
45
46
  done();
}


// BrowserSync reload
function browserSyncReload(done) {
  browsersync.reload();
  done();
}


// Clean vendor
fork icon0
star icon0
watch icon0

54
55
56
57
58
59
60
61
62
63
      })
    )
    .pipe(pug({ pretty: true }))
    .pipe(dest(options.views.dest))
    .pipe(
      browsersync.reload({
        stream: true,
      })
    );
}
fork icon0
star icon0
watch icon0

+ 2 other calls in file