-->

Gulp css styles are not updated

2019-01-29 08:19发布

问题:

I have problem. Yestrday I had to update the Node.js kernel and now that I change something in the LESS file, there will be no css update. Gulpfile is the same as before the update. Could someone advise me what's wrong with my gulpfile script?

The HTML file update is OK.

//*********** IMPORTS *****************
var gulp = require('gulp'),
browserSync = require('browser-sync');
var postcss = require('gulp-postcss');
var less = require('gulp-less');
var watch = require('gulp-watch');
var livereload = require('gulp-livereload');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat-css');
var cssmin = require('gulp-cssmin');


/* BROWSERSYNC */
gulp.task('browserSync', function () {
    var files = ['orient-spa/**'];

    browserSync.init(files, {
       server: {
          baseDir: 'orient-spa/',
          index: 'index.html'
       },
       logPrefix: 'OS01', 
       browser: ['chrome']
    });
});

gulp.task('css', function () {
    var processors = [
        autoprefixer
    ];
    return gulp.src('./orient-spa/skins/less/index-files.less')
    .pipe(less())
    .pipe(postcss(processors))
    .pipe(gulp.dest('./orient-spa/skins/css/'))
    .pipe(livereload());
});

gulp.task('watch', function() {
    livereload.listen();
    gulp.watch('./orient-spa/skins/less/*.less', ['css']);
    gulp.watch('./orient-spa/skins/css/*.css', ['concatMinify']);
});

gulp.task('concatMinify', function () {
    return gulp.src('./orient-spa/skins/css/*.css')
    .pipe(concat("index.css"))
    .pipe(cssmin())
    .pipe(gulp.dest('./orient-spa/skins/css/compiled'))
    .pipe(livereload());
});

gulp.task('default', ['browserSync', 'watch', 'css', 'concatMinify']);

Thanks for your advice :-)

回答1:

I try this path, but problem remains.

Last version node.js was Node.js 7.2.1 (Node.js), now Node.js 9.8.0.

I attach an image to the console after changing 1 line in the LESS file.

Here I see that the set of commands does not call correctly. Or they are called repeatedly. Do not you see a mistake here, please?

Thanks for your advice