Closed danilo-valente closed 9 years ago
It seems to be working for me. What versions of uglify and gulp are you using? Can you give me a bit more of your gulp config and .js files?
Sure, here's what I was trying to do:
gulp.task('build', function () {
return gulp.src('src/index.html')
.pipe(assetTransform({
js: {
tasks: ['concat', uglify()]
}
}))
.pipe(gulp.dest('dist'));
});
I tried the code above on my bower dependencies, so my index.html
is something like this:
<!-- at:js >> scripts/vendor.js -->
<script src="bower_components/modernizr/modernizr.js"></script>
<script src="bower_components/jquery/jquery.js"></script>
<!-- at:end -->
I ran this code on Ubuntu, with gulp@3.8.10
, gulp-uglify@1.0.2
and uglify@2.4.15
.
The weird thing is that I ran this same code on a Mac OS X with gulp-uglify@1.0.2
and it worked. I can't remember the exact gulp version, but it was ^3.8.10
.
Does flipping 'concat' and uglify fix the problem? Also, you could try the stream function option:
gulp.task('build', function () {
return gulp.src('src/index.html')
.pipe(assetTransform({
js: {
stream:function(filestream, outputFilename){
return filestream
.pipe(concat(outputFilename)); //concat is gulp-concat
.pipe(uglify());
}
}
}))
.pipe(gulp.dest('dist'));
});
Flipping worked, but I needed uglify to be run before 'concat'. I just tested with 'stream' and it worked too, thanks.
I don't have the original code anymore, then I can't reproduce the error, but it seems that it's not related to gulp-asset-transform. Therefore, I'm closing this issue. Anyway, thanks for your help.
If I have something like this:
It emits a
write after end
error.