有一天,我的吞咽脚本工作得很好,而现在是这样。
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)奇怪的是,我去掉了所有的过滤器,即
```javascriptGulp.task(‘缩小:仪表板’,‘注入:仪表板’,function() {
var资产;
返回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或gulp filter包有问题,还是我用错了?
我已经在gulp filter git repo上发布了同样的问题,因为我认为这是一个gulp filter的错误。
这里应该做些什么呢?
发布于 2016-12-22 05:44:10
对于任何寻求答案的人来说,原来我更新到了吞咽4,从而打破了依赖关系。希望这能有所帮助。
https://stackoverflow.com/questions/36415755
复制相似问题