gulp-notify - get file name, not whole path, with error -


i'm using gulp-notify , gulp-plumber catch errors gulp-sass , notify me before throws error in gulp , stops whole build process. however, error shown gulp-notify isn't particularly helpful...it contains whole path file error; know path file is, need know file name , line number (and column number added not necessary bonus), , actual error message. here code:

gulp.task('styles', function () {     var onerror = function(err) {       notify.onerror({         title:    "gulp",         subtitle: "build error!",         message:  "<%= error.message %>",         sound:    "beep"       })(err);       this.emit('end');     };     gulp.src('assets/styles/source/style.scss')         .pipe(plumber({errorhandler: onerror}))         .pipe(sass({             style: 'compressed',             errlogtoconsole: false          }))         .pipe(gulp.dest('assets/styles/build'))         .pipe(autoprefixer({             browsers: ['last 2 versions', 'ie 9', 'ios 6', 'android 4'],             cascade: false         }))         .pipe(gulp.dest('assets/styles/build'))         .pipe(minifycss({             keepspecialcomments: '*'         }))         .pipe(gulp.dest('./'))         .pipe(reload({stream: true})); }); 

there's more (like gulp-watch, browsersync, js stuff) think above that's needed solve issue. let me know if not!

so question is, how modify error message show me file name, line number , error message (e.g _header.scss:17 - invalid property name)? i'm using error.message can't find more tags can use things want show.

thank you!

here's how solved problem:

.pipe(sass(     ({       style: 'compressed',       errlogtoconsole: false,       onerror: function(error) {         notify({           title: "sass error",           message: "line " + error.line + " in " + error.file.replace(/^.*[\\\/]/, '') + "\n" + error.message         }).write(error);       }     })   ) ) 

i noticed i'm able provide 1 line break "\n" wasn't able split each piece of information wanted on own line.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -