S
S
site-20172018-01-16 12:39:48
HTML
site-2017, 2018-01-16 12:39:48

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']);

When making changes to .less files, the changes are not written to the 'bundle.min.css' file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
site-2017, 2018-01-18
@site-2017

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 question

Ask a Question

731 491 924 answers to any question