GithubHelp home page GithubHelp logo

Comments (11)

matchabros avatar matchabros commented on May 27, 2024

This might be helpful for you - https://www.npmjs.com/package/gulp-plumber

from gulp-postcss.

TrySound avatar TrySound commented on May 27, 2024

@11bit @matchabros It's gulp issue. Where it catches only last pipe error. I decide it with

gulp.task('css', function (done) {
  return gulp.src(...)
    // not last pipe
    .pipe(postcss(...))
    .on('error', done)
    // Last pipe error will be caught
    .pipe(gulp.dest(...))
})

from gulp-postcss.

11bit avatar 11bit commented on May 27, 2024

@matchabros @TrySound Thanks guys. Anyway gulp 4 is going to bring a new error handling. I hope it won't need to use plumber of custom error handling no more.

from gulp-postcss.

lmartins avatar lmartins commented on May 27, 2024

I've tried using gulp-plumber for this unfortunately it still stops compilation on every single fail.

gulp.task('css', function () {
    var processors = [
        atImport,
        simplevars,
        map(opts),
        nestedcss,
        colorFunction,
        ms,
        lost,
        autoprefixer({browsers: ['last 1 version', 'ie 10']})
    ];
    return gulp.src('./css/main.css')
        .pipe( plumber() )
        .pipe( sourcemaps.init() )
        .pipe( postcss(processors) )
        .pipe( rucksack() )
        // .pipe( nano() )
        .pipe( sourcemaps.write('.') )
        .pipe( gulp.dest('build/css/') )
        .pipe( browserSync.stream({match: "**/*.css"}) );
        // .pipe( browserSync.reload({stream: true, match: "**/*.css"}) );
});

from gulp-postcss.

TrySound avatar TrySound commented on May 27, 2024

@lmartins plumber is ugly hack. You can see here in case how I organize my build process.

from gulp-postcss.

lmartins avatar lmartins commented on May 27, 2024

Thanks @TrySound, will study your example :)

from gulp-postcss.

matchabros avatar matchabros commented on May 27, 2024

@lmartins your issue might be coming from not using an error handler with gulp-plumber.

I just had a look myself and got rid of my errorHandler inside of .pipe(plumber()) and it does stop compiling on an error.

Here's the errorHandler I use in my build.

function errorAlert(err) {
  $.notify.onError({
    title: 'Gulp Error',
    message: 'An error occured, check your terminal',
    sound: 'Basso'
  })(err);
  gutil.log(gutil.colors.red(err.toString()));
  this.emit('end');
}

from gulp-postcss.

TrySound avatar TrySound commented on May 27, 2024

@matchabros The problem is that for CI this code won't exit with error code.

from gulp-postcss.

matchabros avatar matchabros commented on May 27, 2024

@TrySound Pardon me if my lack of knowledge will come out right now, but could you elaborate on what you meant ?

from gulp-postcss.

TrySound avatar TrySound commented on May 27, 2024

@matchabros If you use something like travis ci,this.emit('end') will end task but without error. It will just passes by with some log.

from gulp-postcss.

matchabros avatar matchabros commented on May 27, 2024

@TrySound I see, thanks for taking a moment and explaining.

from gulp-postcss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.