Answer the question
In order to leave comments, you need to log in
How to force css changes to be displayed without reloading the page?
Hello. Recently updated the galpa libraries. Now BrowserSync has stopped working. As I understand it, thread is responsible for updating the page without reloading. I went to the site, did as they say, did not help. Tell me how to return the functionality? I was only able to do a full page reload, but this is very inconvenient. Here is the code
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync').create(),
cleanCSS = require('gulp-clean-css'),
autoprefixer = require('gulp-autoprefixer'),
bourbon = require('node-bourbon'),
uglify = require('gulp-uglify'),
pump = require('pump'),
babel = require('gulp-babel');
gulp.task('browser-sync', function() {
browserSync.init({
proxy: "hospital-7-site",
notify: false
});
});
gulp.task('sass', function() {
return gulp.src('wp-content/themes/hospital7/stylesheet/stylesheet.sass')
.pipe(sass({
includePaths: bourbon.includePaths
}).on('error', sass.logError))
.pipe(autoprefixer(['last 15 versions']))
.pipe(cleanCSS())
.pipe(gulp.dest('wp-content/themes/hospital7/stylesheet/'));
});
gulp.task('compress', function (cb) {
pump([
gulp.src('wp-content/themes/hospital7/js/*.js'),
babel({
presets: ['env']
}),
uglify(),
gulp.dest('wp-content/themes/hospital7/dist')
],
cb
);
});
gulp.task('watch', ['sass', 'compress', 'browser-sync'], function() {
gulp.watch('wp-content/themes/hospital7/stylesheet/stylesheet.sass', ['sass']).on('change', browserSync.reload);
gulp.watch('wp-content/themes/hospital7/*.php', browserSync.reload);
gulp.watch('wp-content/themes/hospital7/js/*.js', ['compress']).on('change', browserSync.reload);
});
gulp.task('default', ['watch']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question