I have 2 tasks that must be performed sequentially and produce an error silently so as not to stop the clock. I did one task, it depends on another, and the first task is to have a callback that is called when it ends with an argument to indicate whether it succeeds. Now my problem is that when calling call with a non-zero argument indicating an error, an msg error occurs, which really causes annoyance, since it distracts me from the actual error that occurred, so there is a way to hide this error message.
Let me show you what I have.
gulp.task('stylus', function (cb) {
var err = null;
gulp.src('app/**/*.styl')
.pipe(plumber(function(error){
err = true;
gutil.log(error.toString());
}))
.pipe(changed('build/css/',{ extension: '.css' }))
.pipe(stylus())
.pipe(gulp.dest('build/css/'))
.on('end',function(){cb(err)});
});
gulp.task('css-concat',['stylus'], function(){
gulp.src('build/css/**/*.css')
.pipe(plumber())
.pipe(concat('app.css'))
.pipe(gulp.dest('build/'));
});
gulp.task('watch', ['css-concat'], function () {
var cssWatch = gulp.watch('app/**/*.styl', ['css-concat']);
cssWatch.on('change', function (event) {
if (event.type === 'deleted') {
var t = event.path.replace(".styl",".css").replace(/^.+\\app\\/,"build/css/");
del(t);
}
});
});
, css-concat stylus , stylus , change call css-concat.
, , stylus ( - , )
[03:14:38] Starting 'stylus'...
[03:14:39] ParseError in plugin 'gulp-stylus'
Message:
D:\angularjs\app\app.styl:1:19
1| my-color = blue.............
------------------------^
2|
3| body
4| background-color my-color
illegal unary "...", missing left-hand operand
[03:14:39] 'stylus' errored after 14 ms
[03:14:39] Error: true
at formatError (C:\Users\Karim\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:161:10)
at Gulp. (C:\Users\Karim\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:187:15)
at Gulp.emit (events.js:95:17)
at Gulp.Orchestrator._emitTaskDone (D:\angularjs\node_modules\gulp\node_modules\orchestrator\index.js:264:8)
at D:\angularjs\node_modules\gulp\node_modules\orchestrator\index.js:275:23
at finish (D:\angularjs\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:21:8)
at cb (D:\angularjs\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:29:3)
at DestroyableTransform. (D:\angularjs\gulpfile.js:28:30)
at DestroyableTransform.emit (events.js:117:20)
at D:\angularjs\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:965:16