I am new to sourcemapping, but I am asked to save sourcemap in an external file, but so far I have managed to concat the sourcemap to the minified .js file. What should I add or take out from this? Or maybe I have got this completely wrong..
return gulp.src(sourceFiles)
.pipe(sourcemaps.init())
.pipe(concat('minifiedJS.min.js'))
.pipe(sourcemaps.write('maps'))
.pipe(gulp.dest(destinationFolder))
From the docs for gulp-sourcemaps
:
To write external source map files, pass a path relative to the destination to
sourcemaps.write()
.
Try passing the current directory (.
) as the target path for the source maps.
return gulp.src(sourceFiles)
.pipe(sourcemaps.init())
.pipe(concat('minifiedJS.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(destinationFolder))