-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gulp crashes when there's an error in my sass files #44
Comments
If you pass errLogToConsole: true into the options hash, sass errors will be logged to the console. Use this option with gulp.watch to keep gulp from stopping every time you make a typo in your sass file.
|
I added |
I am using: gulp.task('scss', function() {
gulp.src('sources/scss/main.scss')
.pipe(sass())
.on('error', gutil.log)
.pipe(gulp.dest('./public/css'));
}); It looks fine but the errors are not really well structured { plugin: 'gulp-sass',
showStack: undefined,
name: 'Error',
message: 'sources/scss/forms:20: error: error reading values after display\n',
fileName: undefined,
lineNumber: undefined } |
use gulp-plumber to handle errors
|
|
@rottmann Thanks, that's awesome. |
Thanks @rottmann Love gulp-lumber. Great tip |
what a cool name |
nice gulp-plumber! |
@rottmann thank you--better workflow now. |
@rottmann thanks a lot you awesome! |
thanks, gulp-plumber is nice thing! |
plumber without sass({errLogToConsole: true}) doesn't work correct, crashed if found error in sass file... |
@rottmann it's cool thanks |
@rottmann How can I use gulp-plumber and browerSync together. It's always crashed when there was a error in sass file whether I installed gulp-plumber or not. Please help me with this one! |
I'm also the error with |
Hmm. I tried using gulp-plumber with browsersync and gulp-sass.. It throws the error, doesn't crash the server, but it stops watching my files for changes..
|
@CalebBarnes This worked for me:
|
Hello. I can't figure out how I can use |
Usually gulp-sass stops files processing after an error occured. So some files that do not have any error may remain uncompiled. The gulp-flatmap can be used to handle errors per-file so each file takes a chance to be processed.
|
@ta-riq Emitting the 'end' event prevents gulp crashing in case of an 'error' event has occured. It's a fine solution if you really expect to process files with SASS compiler until a first error. For example, let's a folder contains three files: bad.scss, good1.scss, and good2.scss. The good2.scss has changed and the bad.scss has an error. Which files will be processed to the dest? It depends on the order in which gulp.src() emits the files. If bad.scss is emitted the first then no any file will be processed because the pipe receives the 'end' event immediately. So you will not see good2.scss changes nor in the dest folder nor in the browser. If gup.src() emits files in some other order [good2.sass, bad.sass, good1.sass] or [good1.sass, bad.sass, good2.sass] then just a single file will be compiled. But the result is not predictable. Some styles will be updated and some will not. Since a |
Thank you! It is really help me and fixed but with crashed scss compiler |
It would be great to avoid having to restart gulp every time I make a typo in my sass file. Is it something I can work around?
The text was updated successfully, but these errors were encountered: