gulpbrowser-syncgulp-watchgulp-sassgulp-concat

Gulp suddenly stopped watching changes, compiling scss to css and opening and reloading page


I have been working on a project for a while, using Gulp for compiling SCSS to CSS (making one CSS file from several SCSS files), minifying CSS, also watching file changes and reloading page with Browser Sync.

While changing some scss and html code and not doing anything to the gulpfile and not renaming any files, page in a browser has suddenly failed and said that it cannot find a page.

I tried to reload the page with "gulp" command and it didn't help.

Now I have several problems. Gulp: - stopped watching changes; - compiling scss to css; - opening and reloading page.

All these worked perfectly before this problem.

Here's my code for Gulp:

var gulp = require("gulp");
var sass = require("gulp-sass");
var watch = require("gulp-watch");
var csso = require("gulp-csso");
var concat = require("gulp-concat");
var browserSync = require("browser-sync").create();

/* Static Server + watching scss/html files */
gulp.task("serve", ["sass"], function() {

    browserSync.init({
        server: "./"
    });

    gulp.watch("*.html").on("change", browserSync.reload);
    gulp.watch("sass/*.scss", ["sass"]).on("change", browserSync.reload);
});

/* Compile Sass into CSS & auto-inject into browsers */
gulp.task("sass", function() {
    return gulp.src("sass/*.scss")
        .pipe(sass().on('error', sass.logError))
        .pipe(gulp.dest("css"))
        .pipe(browserSync.stream());
});

/* Concatenate and minify CSS */
gulp.task("css:build", function() {
	gulp.watch("css/*.css").on("change", function() {
		return gulp.src("css/*.css")
		.pipe(concat("style.concat.css"))
		.pipe(csso({
			comments: false
		}))
		.pipe(gulp.dest("css_result"));
	});
});

gulp.task("default", ["serve", "css:build"]);

If I run "gulp" in command line now it shows this: enter image description here

Why could it happen and what steps should I do now?


Solved

Problem's solved. There was a mistake inside one sass file. After a correction everything started working without any other changes.


Solution

  • Problem's solved. There was a mistake inside one sass file. After a correction everything started working without any other changes.