2016-06-08 3 views
1

발생하지 않습니다. 중간 결과는 gen 디렉토리에 저장되고 최종 결과는 대상 디렉토리에 저장됩니다.gulp.dest()는 파일 업데이트 다음 디렉토리 구조를 감안할 때

개발 중에 대상 디렉토리를 모니터링하고 변경 사항을 Grails 기반 응용 프로그램이 포함 된 별도의 디렉토리에 동기화하려고합니다. 우리는이를 위해 다음 코드를 사용

'use strict'; 

var debug   = require('gulp-debug'); 
var config  = require('../config'); 
var gulp   = require('gulp'); 
var watch   = require('gulp-watch'); 

module.exports = { 
    //command: 'prod', 
    //desc: 'Builds "production" version', 
    run: function(){ 
    gulp.task('watch', ['server'], function() { 

     // Copy files from the 'target' directory to the framework directory while developing 
     var source = config.dist.root, 
      destination = config.fw.root; 

     gulp.src(source + '/**/*', {base: source}) 
      .pipe(debug({title: 'unicorn:'})) 
      .pipe(watch(source + '/**/*', {base: source})) 
      .pipe(debug({title: 'minotaur:'})) 
      .pipe(gulp.dest(destination)) 
      .pipe(debug({title: 'centaur:'})); 

    }); 
    } 
}; 

나는 빌드 체인 화재 소스 파일을 업데이트하고 대상 디렉토리에 업데이트 된 결과를두고합니다. 그러나 업데이트는 Grails 디렉토리를 분리하기 위해 동기화되지 않습니다. 나는 기록을 확인할 때,이를 참조하십시오

[14:29:42] Rebundle... 
[14:29:42] minotaur: target\web-app\portal\js\appLoader.js 
[14:29:43] minotaur: target\web-app\portal\js\appLoader.js 

이 파일이 대상 디렉토리에 재생되고 재생이 꿀꺽 시계 패키지에 의해 포착 것 같다. 그러나 파일은 gulp.dest() 함수로 작성되지 않습니다.

여기에 어떤 일이 벌어 질까요?

답변

0

시행 착오 후에 파이프 라인 중간에 watch()을 사용할 수없는 것으로 보입니다. 대신 파이프 라인의 헤드로 사용해야합니다 (gulp.src() 대신). 단일 파이프 라인을 두 개의 개별 파이프 라인으로 분할하면 문제가 해결됩니다.

그래서 (간결함을 위해 제거 debug() 문) :

gulp.src(source + '/**/*', {base: source}) 
     .pipe(watch(source + '/**/*', {base: source})) 
     .pipe(gulp.dest(destination)); 

이되다 :

gulp.src(source + '/**/*', {base: source}) 
     .pipe(gulp.dest(destination)); 

watch(source + '/**/*', {base: source}) 
     .pipe(gulp.dest(destination));