Answer the question
In order to leave comments, you need to log in
Is Browser-sync slow?
Good afternoon.
Suggest a poll.
Browser-sync processes changes slowly from 3 seconds to 5. And how to set up HTML to process it too.
Maybe there is a problem in the firewall (I use Windows 10 - PHPStorm-set autosave 1sec.)? Thank you in advance
const gulp = require ('gulp');
const autoprefixer = require('gulp-autoprefixer');
const cleanCSS = require('gulp-clean-css');
const browserSync = require('browser-sync').create();
const config = {
src:'./src',
css: {
src:'/preassets/css/**/*.css',
dest:'/assets/css'
}
};
gulp.task('build', function () {
gulp.src(config.src + config.css.src)
.pipe(autoprefixer({
browsers: ['>0.1%'],
cascade: false
}))
.pipe(cleanCSS())
.pipe(gulp.dest(config.src + config.css.dest))
.pipe(browserSync.reload({
stream:true
}));
});
gulp.task('watch',['browserSync'], function(){
gulp.watch(config.src + config.css.src,['build']);
});
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: config.src
}
});
});
Answer the question
In order to leave comments, you need to log in
well, I track changes in all files differently without specifying in gulp-file
, unfortunately I don’t know what OS you are in, but I create a project with windows (for example, "site") then I go to the project through cmd and turn on browser-sync : browser -sync start --server --files *"."* behavior is the same
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question