A
A
alexandr_ftf2019-08-07 00:09:00
JavaScript
alexandr_ftf, 2019-08-07 00:09:00

Slow browsersync?

Set up Gulp browserSync. For some reason it works with php slowly (4-6 seconds, normal loading up to 2). This CSS captures on the fly. What could be the problem? And then the meaning disappears and F5 drives.
gulpfile.js settings:

var gulp = require('gulp')
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
var connectPHP = require('gulp-connect-php');
var reload = browserSync.reload

gulp.task("sass", function(){// Создаем таск Sass
  return gulp.src('src/*.scss')// Берем источник
  .pipe(sass())// Преобразуем Sass в CSS посредством gulp-sass
  .pipe(gulp.dest("src")) // Выгружаем результата в папку src
  .pipe(browserSync.stream())
})


gulp.task('serve', function() {
    browserSync.init({
      proxy: "test",
    });
    gulp.watch('src/*.scss', gulp.parallel('sass'));
    gulp.watch('src/*.css').on('change', reload);
    gulp.watch('src/*.html').on('change', reload);
    gulp.watch('src/*.js').on('change', reload);
    gulp.watch('src/js/*.js').on('change', reload);
    gulp.watch('src/php/*.php').on('change', reload);
    gulp.watch('src/*.php').on('change', reload);
   // notify: false // Отключаем уведомления
});


gulp.task('default', gulp.parallel('sass', 'serve'));

PS browserSync works through a php proxy server, maybe there is a problem with it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question