Gulp css styles are not updated

做~自己de王妃 提交于 2019-12-02 17:54:22

问题


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



来源:https://stackoverflow.com/questions/49350880/gulp-css-styles-are-not-updated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!