Gulp plugin for loading or clearing sources content of a sourcemap.
No LLMs for issues.
No LLMs for patches / pull requests.
No LLMs for comments on the bug tracker, including translation.
English is encouraged, but not required. You are welcome to post in your native language and rely on others to have their own translation tools of choice to interpret your words.
Sources content is loaded by default during sourcemaps.write() but this may
be too late. This module allows sources content to be loaded before using
@gulp-sourcemaps/map-sources to rewrite using URL's that might not be valid
on the filesystem.
var mapSources = require('@gulp-sourcemaps/map-sources');
var sourcesContent = require('@gulp-sourcemaps/sources-content');
gulp.src(...)
.pipe(sourcemaps.init())
.pipe(sourcesContent())
.pipe(mapSources(function(sourcePath, file) {
return '../' + sourcePath;
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(...))Takes a object containing options for this plugin.
Seting this option true will cause the sources content to be deleted instead
of initialized.
A function can be passed for clear, this allows removing sources content associated
with some files but not others. The function is called with filename argument for
each source, returning true causes the contents for that file to be cleared.
gulp.src(...)
/* ... */
.pipe(sourcesContent({
clear: function(filename, mainFile) {
/* Clear all sourceContent elements except the one
* associated with sourceMap.file. */
return filename !== mainFile
}
}))
.pipe(gulp.dest(...))MIT