Closed rodoabad closed 8 years ago
Without commenting on the line numbers being wrong from the other reported issues you can get past this by filtering the stream after concat emit's ( it outputs 2 ) by using gulp-filter, you would also have to add a footer yourself to the gulp output for the source map, something like this
var gulp = require('gulp');
var concat = require('gulp-concat-sourcemap');
var uglify = require('gulp-uglify');
var streamFilter = require('gulp-filter');
var footer = require('gulp-footer');
gulp.task('named',function(){
var extractJS = streamFilter('output.min.js');
gulp.src('**/*.js')
.pipe( concat( 'output.min.js') )
.pipe(gulp.dest('.') // Save both files ( .js and .js.map )
.pipe(extractJS) // Filter out the .js.map
.pipe(uglify())
.pipe(footer('//# sourceMappingURL='+ 'output.min.js.map')) // Add an anotation
.pipe(gulp.dest('.'); // Save the .js ( overwrites above save )
}
This is just a work around but it got me past the problem, there may be better ways to do this
var gulp = require('gulp'),
gulp.task('jquery', function() { return gulp.src('src/*.js') .pipe(concat('jquery.min.js', { sourcesContent: true })) .pipe(uglify()) .pipe(gulp.dest('dst')) });