Answer the question
In order to leave comments, you need to log in
Gulp + Browser-sync doesn't update all files why?
var gulp = require('gulp');
var less = require('gulp-less');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var cleanCss = require('gulp-clean-css');
var gulpIf = require('gulp-if');
var browserSync = require('browser-sync').create();
var config = {
paths: {
less: './src/less/**/*.less',
html: './public/index.html'
},
output: {
path: './public',
cssName: 'bundle.min.css'
},
isDevelop: true
};
gulp.task('less', function() {
return gulp.src(config.paths.less)
.pipe(gulpIf(config.isDevelop, sourcemaps.init()))
.pipe(less())
.pipe(concat(config.output.cssName))
.pipe(autoprefixer())
.pipe(gulpIf(!config.isDevelop, cleanCss()))
.pipe(gulpIf(config.isDevelop, sourcemaps.write()))
.pipe(gulp.dest(config.output.path))
.pipe(browserSync.stream());
});
gulp.task('serve', function() {
browserSync.init({
server: {
baseDir: config.output.path
}
});
gulp.watch(config.paths.less, ['less']);
gulp.watch(config.paths.html).on('change', browserSync.reload);
});
gulp.task('default', ['less', 'serve']);
Answer the question
In order to leave comments, you need to log in
Long jumped with a tambourine with this problem. Solved with the help of the program Koala koala-app.com. review of the program https://tokar.ua/read/8814. I throw off the folder with less files in the program, I click to update, if there are errors, the program will show in which file. My input style is normal . And if it doesn't work, then click on the file and click compile . After adding a new file to the less folder, we do the same: open the program-update-click on the new file - compile . Can you reload gulp
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question