当我使用gulp-plumber时,我不知道为什么我的Sass任务会中断。我的Sass任务看起来像这样:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background= "#7a9965"
tools:context="pact.smartpen.AboutActivity">
<TextView
android:text="À propos de"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_centerHorizontal="true"
android:typeface="serif"
android:textSize="30dp"/>
<ImageView
android:id="@+id/imageView1"
android:layout_width="250dp"
android:layout_height="150dp"
android:src="@drawable/sp"
android:layout_below="@+id/textView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:id="@+id/scrollView"
android:layout_below="@+id/imageView1">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:text="Cette application a été développée par 9 élèves de l'école Télécom ParisTech dans le cadre du projet PACT \n \n Arnaud Bonetti \n Oumayma Bounou \n Quentin Chabert \n Benoit Colas \n Fatimata Fall \n Anthony Hu \n Guillaume Grelet \n Louis Marty \n Nicolas Pontois \n \n \n Le code est disponible sur GitHub à l'adresse suivante :\n "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView2"
android:gravity="center_horizontal"
android:typeface="serif"
android:textSize="24dp"
android:layout_alignParentEnd="true" />
<TextView
android:text="https://github.com/PACT11/SmartPen.git \n \n"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
android:id="@+id/textView3"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:layout_below="@id/textView2"
android:typeface="serif"
android:textSize="18dp"/>
</RelativeLayout>
</ScrollView>
当我故意在我的Sass文件中出错时,我收到此错误:
gulp.task('sass', function() {
return gulp.src(['./src/scss/*.scss', './src/scss/**/*.scss'])
.pipe(plumber())
.pipe(sass({
includePaths : [
'./lib/basscss/scss',
'./lib/fluidbox/css'
],
outputStyle: 'expanded'
}))
.pipe(prefix({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(minifyCSS())
.pipe(gulp.dest('./_site/public/css'))
.pipe(gzip())
.pipe(gulp.dest('./_site/public/css'))
.pipe(reload({stream: true}))
});
就是这样 - 它打破了任务。我必须中止gulp任务并从顶部重新运行它。
知道为什么会这样吗?任何帮助表示赞赏。提前谢谢!
答案 0 :(得分:2)
那是因为您正在运行的任务尚未结束。您需要告诉管道工在使用handleError
选项发生错误时结束任务。这是我的管道工配置:
.pipe(plumber({
errorHandler: function(err) {
// display the error message
console.log(err);
// end the errored task
this.emit('end') }
}))
希望这有帮助