与通知一起的咕嘟声错误

编程入门 行业动态 更新时间:2024-10-11 15:18:13
本文介绍了与通知一起的咕嘟声错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道是否有一种方法可以让通知显示gulp-sass错误消息。最好是控制台中显示的实际消息。

我的大嘴巴任务看起来像这样:

gulp.task 'styles',function(){ return gulp.src('src / scss / style.scss') .pipe(sass({style:'compressed',errLogToConsole:true})) .pipe(autoprefixer('last 2 version','safari 5','ie 8','ie 9','opera 12.1','ios 6','android 4'))。管道(gulp.dest('')) .pipe(livereload(server)).pipe(notify({message:'Styles task complete'})); });

我想通知某种错误回调。

任何帮助表示赞赏。

解决方案

在与我自己挣扎后,我发现这个工作: <$ ($ s $ / $ s $ / $ s $ / $ s $) .pipe(sass('src / scss / style.scss' { style:'compressed', errLogToConsole:false, onError:function(err){ return notify()。write(err); } })) .pipe(autoprefixer('last 2 version','safari 5','ie 8','ie 9','opera 12.1','ios 6','android 4' )) .pipe(gulp.dest('')) .pipe(livereload(server)) .pipe(notify({message:'Styles task complete'))); });

您需要使用 onError 选项,gulp-sass提供。

希望有帮助!

I wondered if there is a way to have notify display a message on gulp-sass error. preferably the actual message that is displayed in the console.

my gulp task looks like this:

gulp.task('styles', function() { return gulp.src('src/scss/style.scss') .pipe(sass({ style: 'compressed', errLogToConsole: true })) .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) .pipe(gulp.dest('')) .pipe(livereload(server)) .pipe(notify({ message: 'Styles task complete' })); });

I'd like to pipe the notify to some kind of error callback.

Any help appreciated.

解决方案

After struggling with this myself I found that this worked:

gulp.task('styles', function() { return gulp.src('src/scss/style.scss') .pipe(sass({ style: 'compressed', errLogToConsole: false, onError: function(err) { return notify().write(err); } })) .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) .pipe(gulp.dest('')) .pipe(livereload(server)) .pipe(notify({ message: 'Styles task complete' })); });

You need to catch the error using the onError option that gulp-sass provides.

Hope that helps!

更多推荐

与通知一起的咕嘟声错误

本文发布于:2023-11-27 11:34:38,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   通知

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!