Reputation: 19453
I am trying to use gulp-sourcemaps to generate source map.
Example code:
gulp.task('compressjs', function() {
gulp.src(['public/js/**/*.js','!public/js/**/*.min.js'])
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('public/js'))
.pipe(sourcemaps.write('/'))
.pipe(gulp.dest('public/js'));
});
The output of the path is //# sourceMappingURL=/script.min.js.map
, which is the wrong path. The correct one should be //# sourceMappingURL=script.min.js.map
. How can I remove that extra /
in the URL?
Upvotes: 2
Views: 2131
Reputation: 15417
Use sourcemaps.write('.')
to write the map file to same directory as js file.
Also the first .pipe(gulp.dest('public/js'))
is not necessary.
Upvotes: 4