2016-08-08 8 views
1

Streamqueue, sass, plumber를 사용하여 꿀꺽 마는 작업에 문제가 발생하여 끝에 보지 못했습니다. 작업은 공급 업체의 css | scss 파일에서 프로덕션 CSS 파일을 내 자신으로 컴파일하고 있습니다.꿀꺽 마심 streamqueue sass 배관공 시계. 오류로 인해 작업이 중단됩니다.

gulp.task('fincss', function() { 
    watch([workData.sassSrcFiles, workData.cssVendorSrcFiles], {}, function() { 
     var convertFromScssToCssAndConcat = 
      gulp.src(workData.sassSrcFiles) 
       .pipe(plumber(error)) 
       .pipe(sass()); 

     var minifyAndConcatExistingCss = 
      gulp.src(workData.cssVendorSrcFiles) 
       .pipe(plumber(error)); 

     return sq({objectMode: true}, minifyAndConcatExistingCss, convertFromScssToCssAndConcat) 
      .pipe(concat('final.min.css')) 
      .pipe(uglifycss()) 
      .pipe(gulp.dest(workData.cssDest)) 
      .pipe(livereload()); 
    }); 
}); 

var error = function (e) { 
    console.error('Error in plugin "' + e.plugin + '"'); 
    console.error(' "' + e.message + '"'); 
    console.error(' In file "' + e.fileName + '", line "' + e.lineNumber + '".'); 
    console.log('--------------------------------------'); 
    console.log(e); 
}; 

하지만 scss 파일에 오류가 발생하면 작업이 중단됩니다. 그리고 인터넷에서 제공하는 배관공을 사용한 실험은 어쨌든 도움이되지 않습니다. concat 앞에 plumber()를 삽입하거나 오류 처리기에 this.emit('end')을 사용하는 것과 같은 작업은 아무 것도 수행하지 않습니다.

gulp.task('toHtml', function() { 
    watch(workData.pugSrcFiles, {}, function (e) { 
     message('Start generating template.'); 
     gulp.src([workData.pugSrcFiles, '!' + workData.pugSrc + '_*.pug']) 
      .pipe(plumber(error)) 
      .pipe(pug({pretty: true})) 
      .pipe(gulp.dest(pubDir)) 
      .pipe(livereload()); 
    }); 
}); 

같은 다른 나의 작업에서

모든 꽤 좋은 작업을 깨지 않고 작동합니다.

도움말.

답변

0

stream-series를 사용하여 streamqueue를 대체 할 수 있습니다.

은 당신의 설정 파일을 변경

:

var series = require('stream-series'); 

gulp.task('fincss', function() { 
    watch([workData.sassSrcFiles, workData.cssVendorSrcFiles], {}, function() { 
     var convertFromScssToCssAndConcat = 
      gulp.src(workData.sassSrcFiles) 
       .pipe(plumber({errorHandler: function(error) { 
        convertFromScssToCssAndConcat.emit('end') // important 
       }})) 
       .pipe(sass()); 

     var minifyAndConcatExistingCss = 
      gulp.src(workData.cssVendorSrcFiles) 
       .pipe(plumber(error)); 

     return series(minifyAndConcatExistingCss, convertFromScssToCssAndConcat) 
      .pipe(concat('final.min.css')) 
      .pipe(uglifycss()) 
      .pipe(gulp.dest(workData.cssDest)) 
      .pipe(livereload()); 
    }); 

});

+0

안녕하세요, 감사합니다. 하지만 오류가 발생합니다. \ node_modules \ stream-series \ index.js : 23 e.pipe (pauseStream); TypeError : e.pipe가 array.forEach (native)의 at node_modules \ stream-series \ index.js : 23 : 7 Array.forEach (native) at module.exports node_modules \ stream-series \ index.js : 20 : (C : \ projects \ jp \ node_modules \ gulp-watch \ index.js : 144 : 3) at C : \ projects \ jp \ gulpfile.js : \ node_modules \ vinyl-file \ index.js : 52 : 4 at node_modules \ gulp-watch \ node_modules \ vinyl-file \ node_modules \ graceful-fs \ graceful-fs.js : 78 : 16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js : 380 : 3)' –

+0

@ PaulBurilichev, 여기에서 복사 한 오류 로그에서 어떤 일이 일어 났는지 알 수 없습니다. 그러나'스트림 시리즈'는 작동 할 수 있어야한다. 나는 내 프로젝트에서 이것을 사용했다. https://github.com/njleonzhang/generator-gulpionic/blob/master/generators/app/templates/_gulpfile.js 라인 118을 참조 할 수있다. – Leon

+0

대단히 감사합니다! 오타 죄송 –