Can someone explain how to uglify, then concat and finally generate a source map using gulp? I cannot seem to get it working. I am not seeing anything in the API's about this but seems to me that it should be supported. The point is to generate the source map and have the source files be used when setting breakpoints. I have tried putting the concat
first in the following code but when I do that the breakpoints do not work in chrome browser.
I am using
concat = require('gulp-concat'),
and uglify = require('gulp-uglify')
.
gulp.src(['src/app.js', 'src/**/*.js'])
.pipe(sourcemaps.init())
.pipe(uglify({
compress: {
negate_iife: false
}
}))
.pipe(concat("app.concat.js"))
.pipe(rename('app.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('public/js'));
Moving concat
before uglify
seems to make it work.
gulp.src(['src/app.js', 'src/**/*.js'])
.pipe(sourcemaps.init())
.pipe(concat('app.concat.js'))
.pipe(uglify({
compress: {
negate_iife: false
}
}))
.pipe(rename('app.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('public/js'));