Как я могу исправить мой gulpfile js, gulp перестал работать после ошибки - PullRequest
0 голосов
/ 18 февраля 2019

Gulp перестал работать после ошибки в консоли

[18:26:36] Starting 'sass'...

events.js:174
      throw er; // Unhandled 'error' event
      ^
Error: src\scss\style.scss
Error: property "background-color" must be followed by a ':'
        on line 7 of src/scss/style.scss
>>     background-color
   ----^

    at options.error (C:\Users\puux\Desktop\test\node_modules\node-sass\lib\index.js:291:26)
Emitted 'error' event at:
    at DestroyableTransform.onerror (C:\Users\puux\Desktop\test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:558:12)
    at DestroyableTransform.emit (events.js:189:13)
    at onwriteError (C:\Users\puux\Desktop\test\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:449:12)
    at onwrite (C:\Users\puux\Desktop\test\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:470:11)
    at WritableState.onwrite (C:\Users\puux\Desktop\test\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:180:5)
    at DestroyableTransform.afterTransform (C:\Users\puux\Desktop\test\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:93:3)
    at errorM (C:\Users\puux\Desktop\test\node_modules\gulp-sass\index.js:118:12)
    at Object.callback (C:\Users\puux\Desktop\test\node_modules\gulp-sass\index.js:127:16)
    at options.error (C:\Users\puux\Desktop\test\node_modules\node-sass\lib\index.js:294:32)

После этого мне снова нужно набрать gulp в консоли.Как я могу избежать этого?

var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');

gulp.task('reload', function(){
browserSync.reload();

});
gulp.task('serve', ['sass'], function(){
browserSync({
    server: 'src'
});

gulp.watch('src/*.html', ['reload']);
});
gulp.watch('src/scss/**/*scss', ['sass']);
gulp.task('sass', function(){
    return gulp.src('src/scss/**/*scss')
    .pipe(sass().on('erorr', sass.logError))
    .pipe(gulp.dest('src/css'))
    .pipe(browserSync.stream());
});

gulp.task('default', ['serve']);

Вот мой код.Я не хочу снова начинать глотать после каждой ошибки.Я думаю, что это не должно работать, и я делаю что-то плохое с моим кодом js.

...