/// The browser sync prototyping gulp.task('bsync', () => { // Syncs browser browserSync.init({ server: { baseDir: './' }, open: true, startPath: "./test/html/test-all.html", // Makes it easier to test on external mobile devices host: "0.0.0.0", tunnel: true }); // Detect change -> rebuild TS gulp.watch(['src/**.js'], gulp.series('minify')); });
const bs = liteServer({ console: consoleStubs, argv: [] }, callbackStub); assert.ok(bs.init, 'returns browsersync'); assert.ok( browserSyncMethodStubs.init.calledWithMatch({ ); assert.ok(bs.init, 'returns browsersync'); assert.ok(consoleStubs.info.calledWithMatch('Did not detect')); }); assert.ok(bs.init, 'returns browsersync');
gulp.task('styles', () => { return gulp .src(routes.styles.scss) .pipe(plumber({})) .pipe(sass()) .pipe(gulp.dest(routes.files.css)) .pipe(browserSync.stream()); });
gulp.task('serve', ['styles', 'templates'], () => { browserSync.init({ server: `${baseDirs.dist}`, }); gulp.watch( [routes.templates.pug, routes.templates._pug, routes.scripts.js], ['templates'] ); gulp.watch([routes.styles.scss, routes.styles._scss], ['styles']); });
gulp.task('templates', ['styles'], () => { return gulp .src([routes.templates.pug, '!' + routes.templates._pug]) .pipe(pugLint()) .pipe(plumber({})) .pipe( pug({ locals: { emojis: lifes() }, }) ) .pipe(gulp.dest(routes.files.html)) .pipe(browserSync.stream()); });
gulp.task('watch', ['serve'], function() { gulp.watch(paths.source, ['build-system', browserSync.reload]).on('change', reportChange); gulp.watch(paths.html, ['build-html', browserSync.reload]).on('change', reportChange); gulp.watch(paths.style, ['build-styles']).on('change', reportChange); gulp.watch(paths.style, function() { return gulp.src(paths.style) .pipe(browserSync.stream()); }).on('change', reportChange); });
// the real stuff gulp.task('default', ['browser-sync'], () => { // gulp.watch('./views/**/*.hbs', bs.reload); gulp.watch('./public/**/*.js', bs.reload); gulp.watch('./public/css/**/*.css', bs.reload); gulp.watch(['./routes/**/*.js', './app.js', './bin/www', './views/**/*.hbs'], ['bs-delay']); setTimeout(() => openBrowser('http://localhost:4000'), 1000); });
gulp.task('browser-sync', function() { browserSync.init(null, { baseDir: config.bSync.baseDir, proxy: config.bSync.proxy, port: config.bSync.port }); });
gulp.task('source', function(){ gulp.src('src/example/**/*.!(less)', option) .pipe(gulp.dest(dist)) .pipe(browserSync.reload({stream: true})); });
// browser sync watching files gulp.task('watch', ['browser-sync'], function () { gulp.watch(['*.html', 'src/scripts/*.js', 'src/styles/*.css']).on('change', browserSync.reload); gulp.watch('src/**/*.js', ['webpack']); });
gulp.task('browser-sync', ['build', 'nodemon'], function() { browserSync.init({ proxy: 'http://localhost:9000', port: 7000, browser: ['google chrome'] }); });
gulp.task('default', ['css', 'js'], () => { browserSync.init({ server: { baseDir: ['./test/sandbox', './'] } }) gulp.watch(['./mocha-extjs.js', './src/**/*', './test/suites/**/*', './test/sandbox/app/**/*'], ['js']) gulp.watch('./scss/*.scss', ['css']) gulp.watch(['./dist/*'], browserSync.reload) })
gulp.task('styles', () => { return gulp .src(routes.styles.scss) .pipe(plumber({})) .pipe(sass()) .pipe(gulp.dest(routes.files.css)) .pipe(browserSync.stream()); });
gulp.task('serve', ['styles', 'templates'], () => { browserSync.init({ server: `${baseDirs.dist}`, }); gulp.watch( [routes.templates.pug, routes.templates._pug, routes.scripts.js], ['templates'] ); gulp.watch([routes.styles.scss, routes.styles._scss], ['styles']); });
gulp.task('templates', ['styles'], () => { return gulp .src([routes.templates.pug, '!' + routes.templates._pug]) .pipe(pugLint()) .pipe(plumber({})) .pipe( pug({ locals: { emojis: lifes() }, }) ) .pipe(gulp.dest(routes.files.html)) .pipe(browserSync.stream()); });