How to use the browser-sync.active 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 dsebastien / midnightLightV2 / gulp / tasks / ts-lint.js View on Github external
gulp.task('ts-lint', 'Lint TypeScript code', () =>{
	return utils.plumbedSrc(// handle errors nicely (i.e., without breaking watch)
			config.typescript.srcAppOnly // only the application's code needs to be checked
	)

	// Display the files in the stream
	//.pipe(debug({title: 'Stream contents:', minimal: true}))

	// Check the code quality
	.pipe(tslint())

	// Fail the build only if BrowserSync is not active
	.pipe(iff(!browserSync.active, tslint.report('prose')))
	.pipe(iff(browserSync.active, tslint.report('prose', {
		emitError: false
	})))

	// Task result
	.pipe(size({
		title: 'ts-lint'
	}));
});
github plasma-umass / browsix / examples / latex-editor / gulpfile.babel.js View on Github external
return () => {
    return gulp.src(files)
      .pipe(reload({stream: true, once: true}))
//      .pipe($.eslint(options))
      .pipe($.eslint.format())
      .pipe($.if(!browserSync.active, $.eslint.failAfterError()));
  };
}
github jakemmarsh / react-rocket-boilerplate / gulp / tasks / browserify.js View on Github external
function rebundle() {
    const stream = bundler.bundle();

    gutil.log('Rebundle...');

    return stream.on('error', handleErrors)
    .pipe(source(file))
    .pipe(gulpif(global.isProd, streamify(uglify())))
    .pipe(streamify(rename({
      basename: 'main'
    })))
    .pipe(gulpif(!global.isProd, sourcemaps.write('./')))
    .pipe(gulp.dest(config.scripts.dest))
    .pipe(gulpif(browserSync.active, browserSync.reload({ stream: true, once: true })));
  }
github h5bp / html5boilerplate.com / gulpfile.js View on Github external
gulp.task('lint:js', function () {
    return gulp.src([
        'gulpfile.js',
        dirs.src + '/js/**/*.js',
    ]).pipe(plugins.jshint())
      .pipe(plugins.jshint.reporter('jshint-stylish'))
      .pipe(plugins.if(!browserSync.active, plugins.jshint.reporter('fail')));
});
github Brooooooklyn / html-parser / gulpfile.js View on Github external
gulp.task('jshint', function () {
  return gulp.src(['src/**/*.js', 'test/spec/**/*.js'])
    .pipe(reload({stream: true, once: true}))
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
    .pipe($.if(!browserSync.active, $.jshint.reporter('fail')));
});
github addyosmani / smaller-pictures-app / gulpfile.babel.js View on Github external
gulp.task('lint', () =>
  gulp.src([
    'app/scripts/main.js',
    //'app/scripts/index.js',
    '!app/scripts/encoder.js',
    '!app/scripts/modernizer.min.js',
    '!app/scripts/FileSaver.min.js',
    '!app/scripts/Blob.js',
    '!app/scripts/canvas-toBlob.js'])
    .pipe($.eslint())
    .pipe($.eslint.format())
    .pipe($.if(!browserSync.active, $.eslint.failOnError()))
);
github fluanceit / angular-dashboard / gulpfile.js View on Github external
function startBrowserSync() {
    if (!env.sync || browserSync.active) {
        return;
    }

    var filestowatch = [
        './demos/**/*.html',
        './src/**/*.js',
        './src/**/*.css',
        './src/**/*.html',
        './src/**/*.json',
        './src/content/images/**/*.*'
    ];

    log('Starting BrowserSync on port ' + server_port);
    browserSync({
        proxy: 'localhost:' + server_port,
        port: 3000,
github intuinno / unit / gulpfile.js View on Github external
function lint(files, options) {
  return gulp.src(files)
    .pipe(reload({stream: true, once: true}))
    .pipe($.eslint(options))
    .pipe($.eslint.format())
    .pipe($.if(!browserSync.active, $.eslint.failAfterError()));
}
github mjibson / moggio / node_modules / material-design-lite / gulpfile.js View on Github external
gulp.task('jscs', function() {
  return gulp.src(['src/**/*.js' , 'gulpfile.js'])
    .pipe(reload({stream: true, once: true}))
    .pipe($.jscs())
    .pipe($.if(!browserSync.active, $.jshint.reporter('fail')));
});
github hsnaydd / moveTo / gulpfile.js View on Github external
gulp.task('scripts:lint', (cb) => {
  return gulp.src('src/scripts/**/*.js')
    .pipe($.eslint())
    .pipe($.eslint.format())
    .pipe(browserSync.active ? $.util.noop() : $.eslint.failOnError());
});