There is a setting in gulpfile.js:

var gulp = require('gulp'), // Подключаем Gulp less = require('gulp-less'), //Подключаем less пакет, browserSync = require('browser-sync'), // Подключаем Browser Sync path = require('path'); gulp.task('less1', function(){ // Создаем таск less return gulp.src('less/**/*.less') // Берем источник .pipe(less([ path.join(__dirname, 'less') ])) // Преобразуем less в CSS посредством gulp-less .pipe(gulp.dest('css')) // Выгружаем результата в папку css .pipe(browserSync.reload({stream: true})); // Обновляем CSS на странице при изменении }); gulp.task('browser-sync', function() { // Создаем таск browser-sync browserSync({ // Выполняем browserSync server: { // Определяем параметры сервера baseDir: '.' // Директория для сервера - . }, notify: false // Отключаем уведомления }); }); gulp.task('watch', ['less1', 'browser-sync'], function() { gulp.watch('less/**/*.less', ['less1', browserSync.reload]); // Наблюдение за less файлами }); 

There are two files in the / less folder. style.less :

 @import url('but.less'); body{ color: red; } 

and but.less :

 .but{ background-color: green; } 

when gulp watch started gulp watch gulp-less builds the style.css file correctly, pulling in styles from the @import url('but.less'); , but when changing in the but.less file while running in the night, the changes from the but.less file but.less not tightened. With this, the driver sees changes in but.less , runs gulp-less and browser-sync, but gulp-less does not apply changes from but.less . If you change the file style.less , then the changes are applied on the fly correctly.

Tried to import but.less using @import 'but.less'; . To no avail.

If you stop working yesterday and start it again, then during the first pass the import pulls up correctly.

 +-- browser-sync@2.23.6 +-- gulp@3.9.1 +-- gulp-less@4.0.0 `-- path@0.12.7 λ npm -v 5.5.1 

Win7 x64

  • To myself and I will answer. Apparently in the version gulp-less@4.0.0 bug. I rolled back the version to 3.5.0 and everything works. You can read more here - github.com/stevelacy/gulp-less/issues/283 - Kappa05
  • Hooray! I'm not the only one) Most likely you are right, at the expense of bugs. Yesterday, I understood all day what was wrong. A similar problem was! Today I will put 3.5 I hope everything will work correctly. - TS E
  • Yes, it looks like problem 4.0.0 or there in the comments offer a solution using gulp-multi-process github.com/stevelacy/gulp-less/issues ... but I have not tried to use it - Heidel

0