S
S
Sergey Burduzha2017-05-22 16:28:25
gulp.js
Sergey Burduzha, 2017-05-22 16:28:25

Why does the browser not see the changes in the style file?

Here is the code in gulpfile.js :
gulp.task('css', function () {
gulp.src('src/less/style.less') // Select our style.less
.pipe(sourcemaps.init())
. pipe(less()) // Compile
.pipe(prefixer()) // Add vendor prefixes
.pipe(sourcemaps.write())
.pipe(gulp.dest('build/css/'))
.pipe(browserSync. stream());
});
gulp.task('watch', function () {
gulp.watch('src/**/*.html', ['html']);
gulp.watch('src/less/**/*.less' , ['css']);
gulp.watch('src/header/header.less', ['headercss']);
gulp.watch('src/js/**/*.js', ['js' ]);
gulp.watch('src/img/**/*.*', ['img']);
gulp.watch('src/img/icons/*.*', ['sprite']);
gulp.watch('src/fonts/**/*.*', ['fonts']);
gulp.watch('src/libs/**/*.*', ['libs']);
});
When I change the style.less file in the editor, then accordingly, the style.css file also changes.
ad8b2311b8ec4a6385d848ed344cf93d.png
The changes are immediately visible in the browser. 5dc2dea978f84727a9b55c83c58d1972.png
There are no errors in the console logs.
The problem is that as soon as I restart the browser, then all the latest changes disappear, just some kind of mysticism.
e51201d1950849929fd7fb7eb966b867.png
The problem is solved only by rebooting gulpa, but it is clear that this is only a crutch. I can not understand what is the problem, why the browser does not see the changes in the style file. So, as soon as I start changing style.less, then, lo and behold, the browser starts seeing these changes again.
In my opinion, something is blocking the browser's access to the style.
Maybe someone faced the same problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Zaitsev, 2017-05-22
@serii81

Ctrl + Shift + RDoes not help? ))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question