2016-09-28 2 views
1

아래 작업을 실행하면 작업이 완료되지 않지만 작업이 올바르게 작동합니다. 수동 콜백을 사용하지만 아무 것도 변경되지 않습니다.굼벵이 작업이 완료되지 않았지만 올바르게 작동합니다.

gulp.task('compileSrc', 
    function() { 
     const imgFilter = plugin.filter('**/*.{jpg,png,gif}', {restore: true}); 
     const fontFilter = plugin.filter('**/*.{ttf,woff,woff2,eot,svg}', {restore: true}); 
     const cssFilter = plugin.filter('**/*.css', {restore: true}); 
     const jsFilter = plugin.filter('**/*.js', {restore: true}); 
     const htmlFilter = plugin.filter('**/*.html', {restore: true}); 

     return gulp.src([paths.src + '/css/**/*.css', paths.src + '/fonts/**/*', paths.src + '/img/**/*', paths.app + '/**/*']) 
     // CSS ****************************************************************** 
      .pipe(cssFilter) 
      .pipe(plugin.concat('app.css'))     // merge all css file to one file 
      // min css file 
      .pipe(
       plugin.minCss({ 
        compatibility: 'ie8', 
        keepSpecialComments: false 
       }) 
      ) 
      // rename css file 
      .pipe(
       plugin.rename({ 
        suffix: '.min' 
       }) 
      ) 
      .pipe(gulp.dest(paths.dist + '/src/css'))   // save to hard file 
      .pipe(cssFilter.restore) 
      // Html Template ****************************************************************** 
      .pipe(htmlFilter) 
      /* minify html */ 
      .pipe(
       plugin.minHtml({ 
        collapseWhitespace: true, 
        removeComments: true 
       }) 
      ) 
      /* convert html file to angular template cache */ 
      .pipe(
       plugin.templateCache({ 
        module: 'rainCrm', 
        root: paths.app 
       }) 
      ) 
      .pipe(htmlFilter.restore) 
      // JS ****************************************************************** 
      .pipe(jsFilter) 
      .pipe(plugin.ngAnnotate()) 
      .pipe(plugin.angularFilesort())   // sort angular files 
      .pipe(plugin.concat('app.js'))   // merge all js file to one file 
      .pipe(plugin.minJs())      // min js file 
      // rename js file 
      .pipe(
       plugin.rename({ 
        suffix: '.min' 
       }) 
      ) 
      .pipe(gulp.dest(paths.dist + '/src/js'))   // save to hard file 
      .pipe(jsFilter.restore) 
      // IMG ****************************************************************** 
      .pipe(imgFilter) 
      .pipe(gulp.dest(paths.dist + '/src/img'))   // save to hard file 
      .pipe(imgFilter.restore) 
      // FONT ****************************************************************** 
      .pipe(fontFilter) 
      .pipe(gulp.dest(paths.dist + '/src/fonts'));  // save to hard file 
    } 
); 

결과 : 올바른

[00:24:18] Starting 'compileSrc'... 

Process finished with exit code 0 

하지만 아래 작업 마무리.

/* compile libraries */ 
gulp.task('compileLibs', 
    function() { 
     const jsFilter = plugin.filter('**/*.js', {restore: true}); 
     const cssFilter = plugin.filter('**/*.css', {restore: true}); 

     return gulp.src(
      plugin.mainBowerFiles({ 
       overrides: { 
        "font-awesome": { 
         main: [ 
          "css/font-awesome.min.css", 
          "fonts/**/*" 
         ] 
        }, 
        "persian-date": { 
         main: [ 
          "dist/0.1.8/persian-date-0.1.8.js" 
         ] 
        } 
       } 
      }) 
     ) 
     // CSS ****************************************************************** 
      .pipe(cssFilter) 
      .pipe(plugin.concat('libs.css'))   // merge all css file to one file 
      // min css file 
      .pipe(
       plugin.minCss({ 
        compatibility: 'ie8', 
        keepSpecialComments: false 
       }) 
      ) 
      // rename css file 
      .pipe(
       plugin.rename({ 
        suffix: '.min' 
       }) 
      ) 
      .pipe(gulp.dest(paths.dist + '/src/css')) 
      .pipe(cssFilter.restore) 
      // JS ****************************************************************** 
      .pipe(jsFilter) 
      .pipe(plugin.concat('libs.js'))   // merge all js file to one file 
      .pipe(plugin.minJs())       // min js file 
      // rename css file 
      .pipe(
       plugin.rename({ 
        suffix: '.min' 
       }) 
      ) 
      .pipe(gulp.dest(paths.dist + '/src/js')) 
      .pipe(jsFilter.restore) 
      // FONTS ****************************************************************** 
      .pipe(plugin.filter('**/*.{ttf,woff,woff2,eot,svg,png,jpg,gif}')) 
      .pipe(gulp.dest(paths.dist + '/src/fonts')); 
    } 
); 

감사합니다.

+0

(즉' "compileSrc을"이 직접 귀하의 질문에 대답하지 않지만, 난 강력하게 작은 논리적으로 응집 덩어리로 쭉 마시는 작업을 중단하는 것이 좋습니다 것은'구성되어있다 ''compileStyles'',''compileScripts'',''compileResources'')에 대한 정보를 제공합니다. 이 작업을 수행하면 문제가 발생할 가능성이 큽니다. – souldzin

답변

0

감사합니다. 나는 문제를 찾는다.

const fontFilter = plugin.filter('**/*.{ttf,woff,woff2,eot,svg}', {restore: true}); 

은 마지막 필터에서 복원 옵션을 제거해야합니다. (귀국일 스트림 문제 필터 플러그인)

const fontFilter = plugin.filter('**/*.{ttf,woff,woff2,eot,svg}'); 
관련 문제