I have a gulp.task 'scripts'
that uses gulp-uglify
. Then I also added gulp-import
and it didn't work. If i do only uglify
it works. If I do only import
it works. But if i do both at the same time it doesn't work.
Here is the function:
gulp.task('scripts', function(){
gulp.src([
'testgulp/**/*.js', '!testgulp/**/_*.js', '!testgulp/**/*.min.js'
])
.pipe(include()) //if I comment only this line, uglify works
.on('error', console.log)
.pipe(uglify()) //if I comment only this line, include works
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(function(file) { return file.base; }));
});
And then on terminal I have this response when try to do both:
/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/map-stream/index.js:103
throw err
^
GulpUglifyError: unable to minify JavaScript
at createError (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/gulp-uglify/lib/create-error.js:6:14)
at wrapper (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/gulp-uglify/node_modules/lodash/_createHybrid.js:87:15)
at trycatch (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/gulp-uglify/minifier.js:26:12)
at DestroyableTransform.minify [as _transform] (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/gulp-uglify/minifier.js:76:19)
at DestroyableTransform.Transform._read (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
at DestroyableTransform.Transform._write (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
at doWrite (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:313:64)
at writeOrBuffer (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:302:5)
at DestroyableTransform.Writable.write (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:241:11)
at Stream.ondata (stream.js:31:26)
I'm moving away from Koala App and the append/prepend feature was awesome, so i would like to do the same with Gulp. I tried gulp-include and gulp-import, both has the same problem. What i'm doing wrong? Thank you :)
-EDIT- i also tried gulp-sync and hardcode a timeout() on minifyit task, but doesn't fix the problem...