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?