2016-04-05 10 views
0

私のgulpスクリプトはいつかうまくいきました。gulpの依存関係が途中で詰まっている

gulp.task('minify:dashboard', ['inject:dashboard'], function() { 
    var assets; 

    return gulp.src(paths.django.templates.root + '/__dashboard.html') 
    .pipe($.replace('script src="{{ STATIC_URL }}dashboard', 'script src="compile')) 

    .pipe($.useref({ 
     searchPath: '.' 
    })) 

    // versioning assets 
    .pipe(indexHtmlFilter) 
     .pipe($.rev()) 
     .pipe($.debug()) 
     .pipe(indexHtmlFilter.restore) 

    // processing scripts 
    .pipe(jsFilter) 
     // .pipe($.uglify({ 
     // preserveComments: $.uglifySaveLicense, 
     // compress: uglifyCompressOptions 
     // })) 
     .pipe($.size()) 
     .pipe(gulp.dest(paths.django.assets.dashboard + '/builds')) 
     .pipe(jsFilter.restore) 

    // updating references 
    .pipe($.revReplace()) 
    // adding django static url reference 
    .pipe($.replace('src="scripts', 'src="{{ STATIC_URL }}dashboard/builds/scripts')) 
    .pipe(gulp.dest('compile/builds')); 
}); 

このタスクは、それだけで問題なく機能します。私は新しいタスクを導入する際

gulp minify:dashboard 

しかし、

gulp.task('minify', ['minify:common', 'minify:dashboard']); 

は、上記の課題gulp minifyは、私はすなわち、

をすべてのフィルタを削除し、私は、この

events.js:154 
     throw er; // Unhandled 'error' event 
    ^
Error: write after end 
    at writeAfterEnd (/magneto/dashboard/node_modules/readable-stream/lib/_stream_writable.js:203:12) 
    at StreamFilter.Writable.write (/magneto/dashboard/node_modules/readable-stream/lib/_stream_writable.js:239:20) 
    at write (/magneto/dashboard/node_modules/gulp-useref/node_modules/readable-stream/lib/_stream_readable.js:623:24) 
    at flow (/magneto/dashboard/node_modules/gulp-useref/node_modules/readable-stream/lib/_stream_readable.js:632:7) 
    at DestroyableTransform.pipeOnReadable (/magneto/dashboard/node_modules/gulp-useref/node_modules/readable-stream/lib/_stream_readable.js:664:5) 
    at emitNone (events.js:80:13) 
    at DestroyableTransform.emit (events.js:179:7) 
    at emitReadable_ (/magneto/dashboard/node_modules/gulp-useref/node_modules/readable-stream/lib/_stream_readable.js:448:10) 
    at emitReadable (/magneto/dashboard/node_modules/gulp-useref/node_modules/readable-stream/lib/_stream_readable.js:444:5) 
    at readableAddChunk (/magneto/dashboard/node_modules/gulp-useref/node_modules/readable-stream/lib/_stream_readable.js:187:9) 

奇妙なことを提供します

`` `js

gulp.task('minify:dashboard', ['inject:dashboard'], function() { 
    var assets; 

    return gulp.src(paths.django.templates.root + '/__dashboard.html') 
    .pipe($.replace('script src="{{ STATIC_URL }}dashboard', 'script src="compile')) 

    .pipe($.useref({ 
     searchPath: '.' 
    })) 

    // versioning assets 
    //.pipe(indexHtmlFilter) 
     .pipe($.rev()) 
     .pipe($.debug()) 
     //.pipe(indexHtmlFilter.restore) 

    // processing scripts 
    //.pipe(jsFilter) 
     // .pipe($.uglify({ 
     // preserveComments: $.uglifySaveLicense, 
     // compress: uglifyCompressOptions 
     // })) 
     //.pipe($.size()) 
     //.pipe(gulp.dest(paths.django.assets.dashboard + '/builds')) 
     //.pipe(jsFilter.restore) 

    // updating references 
    .pipe($.revReplace()) 
    // adding django static url reference 
    .pipe($.replace('src="scripts', 'src="{{ STATIC_URL }}dashboard/builds/scripts')) 
    .pipe(gulp.dest('compile/builds')); 
}); 

`` `

その後、完全に正常に動作しgulp minifyタスク。ガルプやガルプフィルターパッケージで何か問題があるのですか、それとも間違って使用していますか?

私は既にgulp-filter git repoに同じ質問を投稿していますが、これはgulpフィルタのバグだと思います。

ここで何をする必要がありますか?

答えて

0

誰かが答えを求めていると、私はgulp 4に更新されたことが判明し、依存関係が破られました。お役に立てれば。

関連する問題