D
D
Daisuke-sama2016-08-08 19:31:07
gulp.js
Daisuke-sama, 2016-08-08 19:31:07

Gulp Sass Streamqueue Plumber. How to continue execution on error?

Hello
In gulp I use streamqueueto generate production css from vendor's styles and my scss.
Since this is a recurring task in watch, I plumberwant to use it to complete one task cycle in case of an scss conversion error, and continue to look further for changes, and try to generate again.
In general, execution breaks watchwhen using sass conversion. When I use the conversion from pug/jade - everything is fine - the execution of the task is not interrupted, and the error handler writes what the jamb is.
Chips, like, this.emit('end')in the error handler - also without effect. Just like on('error', callback)sass().
Suggest a solution, please.

gulp.task('fincss', function () {
    watch([workData.sassSrcFiles, workData.cssVendorSrcFiles], {}, function () {
        var convertFromScssToCssAndConcat =
            gulp.src(workData.sassSrcFiles)
                .pipe(plumber(error))
                .pipe(sass());

        var minifyAndConcatExistingCss =
            gulp.src(workData.cssVendorSrcFiles)
                .pipe(plumber(error));

        return sq({objectMode: true}, minifyAndConcatExistingCss, convertFromScssToCssAndConcat)
            .pipe(concat('final.min.css'))
            .pipe(uglifycss())
            .pipe(gulp.dest(workData.cssDest))
            .pipe(livereload());
    });
});

var error = function (e) {
    console.error('Error in plugin "' + e.plugin + '"');
    console.error('   "' + e.message + '"');
    console.error('   In file "' + e.fileName + '", line "' + e.lineNumber + '".');
    console.log('--------------------------------------');
    console.log(e);
};

It works:
gulp.task('toHtml', function () {
    watch(workData.pugSrcFiles, {}, function (e) {
        message('Start generating template.');
        gulp.src([workData.pugSrcFiles, '!' + workData.pugSrc + '_*.pug'])
            .pipe(plumber(error))
            .pipe(pug({pretty: true}))
            .pipe(gulp.dest(pubDir))
            .pipe(livereload());
    });
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question