I'm using Gulp and Bower to get JQuery into my project. However the jquery.min.cs file has a SourceMappingURL at the end of the precompiled file and I would like to remove this.
Currently my Gulp just copy the original file to the destination like that:
gulp.task('jquery', function () {
gulp.src(paths.jquerySrc)
.pipe(gulp.dest(paths.jqueryDest));
});
I found a lot of ways to add source mappings but none to remove. I would like to not recompile all the jquery just for that.
You could try this:
const paths = {
jquerySrc: './path/to/src/jquery.css',
jqueryDest: './path/to/dest/'
};
gulp.task('jquery', function () {
gulp.src(paths.jquerySrc)
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write('/dev/null', {addComment: false}))
.pipe(gulp.dest(paths.jqueryDest));
});
You could also try the strip-source-map-loader package. Never used either, but in theory both should work, maybe.
The gulp-purge-sourcemaps package worked for me. Here's what you would do with your example:
const purgeSourcemaps = require('gulp-purge-sourcemaps');
gulp.task('jquery', function () {
gulp.src(paths.jquerySrc)
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(purgeSourcemaps())
.pipe(gulp.dest(paths.jqueryDest));
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With