Gulp.js stoppt das Kompilieren von LESS, wenn beobachtet wird, dass in den LESS-Dateien ein Fehler aufgetreten ist.

Ich habe ein Problem mitgulp. Ich rennegulp-watch zusammen mitgulp-less undgulp-clean. Alles läuft perfekt.

Wenn ich bearbeitesomefile.less und ich speichere es mit einem fehlenden Semikolon oder vielleicht hinterlasse ich versehentlich ein abschließendes;s, habe nur Fehler in meinem Code beim Speichern,gulp-less meldet einen Fehler in der Konsole. Nachdem ich es repariert habegulp-watch schaut sich die Dateien weiter an, abergulp-less wird nicht ausgelöst und nicht kompiliert. Wenn ich aufhöregulp und starte es erneut im Terminal. Alles läuft wieder normal.

Hier ist meingulpfile.js:

var gulp = require('gulp');
var clean = require('gulp-clean');
var gutil = require('gulp-util');
var less = require('gulp-less');
var watch = require('gulp-watch');
var path = require('path');

gulp.task('clean', function() {
    return gulp.src('src/main/webapp/styles/build', {read: false})
   .pipe(clean().on('error', gutil.log))
});

gulp.task('less', function() {
    return gulp.src(['src/main/webapp/styles/main.less'], {base: 'src/main/webapp/styles/'})
    .pipe(less().on('error', gutil.log))
    .pipe(gulp.dest('src/main/webapp/styles/build'))
    .on('error', gutil.log);
});

gulp.task('watch', function() {
    watch('src/main/webapp/styles/**/*.{less, css}', function() {
        gulp.start('less')
        .on('error', gutil.log);
    })
});

gulp.task('default', ['clean'], function() {
    gulp.start(['less', 'watch'])
    .on('error', gutil.log);
});

nd hier sind meinedevDependencies:

"devDependencies": {
    "gulp": "^3.8.10",
    "gulp-clean": "^0.3.1",
    "gulp-less": "^2.0.1",
    "gulp-util": "^3.0.2",
    "gulp-watch": "^3.0.0"
}

Schließlich ist hier die Nachricht in der Konsole:

[10:21:03] imports/productSearchPage.less was changed
[10:21:03] Starting 'less'...
[10:21:03] { [Error: Unrecognised input. Possibly missing something in file /src/main/webapp/styles/imports/productSearchPage.less line no. 1008]
  type: 'Parse',
  filename: '/src/main/webapp/styles/imports/productSearchPage.less',
  index: 19127,
  line: 1008,
  callLine: NaN,
  callExtract: undefined,
  column: 0,
  extract: [ '', '', undefined ],
  message: 'Unrecognised input. Possibly missing something in file /src/main/webapp/styles/imports/productSearchPage.less line no. 1008',
  stack: undefined,
  lineNumber: 1008,
  fileName: '/src/main/webapp/styles/imports/productSearchPage.less',
  name: 'Error',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-less',
  __safety: { toString: [Function] } }
[10:21:04] imports/productSearchPage.less was changed
[10:21:08] imports/productSearchPage.less was changed
^C

Können Sie mir bitte sagen, was mit dem @ nicht stimmgulp-watch task und hilf mir, es zum Laufen zu bringengulp-less nach Beseitigung der Fehler ohne Neustartgulp.

EDIT: Mein bearbeitetesgulp-less task

gulp.task('less', function() {
    return gulp.src(['src/main/webapp/styles/main.less'], {base: 'src/main/webapp/styles/'})
    .pipe(less().on('error', gutil.log))
    .pipe(gulp.dest('src/main/webapp/styles/build'))
    .on('error', function(err) {
        gutil.log(err);
        this.emit('end');
    });
});

Antworten auf die Frage(8)

Ihre Antwort auf die Frage