gulp-sourcemaps
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@gulp-sourcemaps/identity-map | 2.0.1 | 2.48 kB | MIT | prod | 1 |
@gulp-sourcemaps/map-sources | 1.0.0 | 2.21 kB | MIT | prod | |
acorn | 6.4.2 | 251.52 kB | MIT | prod | |
convert-source-map | 1.9.0 | 3.91 kB | MIT | prod | |
css | 3.0.0 | 9.22 kB | MIT | prod | 1 |
debug-fabulous | 1.1.0 | 23.57 kB | MIT | prod | 1 |
detect-newline | 2.1.0 | 1.65 kB | MIT | prod | |
graceful-fs | 4.2.11 | 9.57 kB | ISC | prod | |
source-map | 0.6.1 | 194.96 kB | BSD-3-Clause | prod | |
strip-bom-string | 1.0.0 | 2.39 kB | MIT | prod | |
through2 | 2.0.5 | 3.96 kB | MIT | prod |
Gulp-sourcemaps is a versatile JavaScript library that provides sourcemap support for gulpjs. The primary function of gulp-sourcemaps is to associate transformed source code with its original version, making it significantly easier to debug and trace the code. Sourcemaps are files that map the relationship between the original source files and the output files after undergoing transformations.
To use gulp-sourcemaps, you would typically require the library at the beginning of your gulp task file. After that, you can initialize sourcemaps with sourcemaps.init()
, apply various gulp plugins for transformation, and then write the sourcemaps with sourcemaps.write()
.
Here's an example of how you'd use it:
var gulp = require('gulp');
var plugin1 = require('gulp-plugin1');
var plugin2 = require('gulp-plugin2');
var sourcemaps = require('gulp-sourcemaps');
function javascript() {
gulp.src('src/**/*.js')
.pipe(sourcemaps.init())
.pipe(plugin1())
.pipe(plugin2())
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
};
exports.javascript = javascript;
In this example, sourcemaps.init()
and sourcemaps.write()
are used to surround the transformation plugins (plugin1()
and plugin2()
in this case). The .pipe()
function chains together these actions, and gulp.dest('dist')
writes the transformed files and their sourcemaps to the 'dist' directory.
The documentation for gulp-sourcemaps can be found on their GitHub repository at git://github.com/gulp-sourcemaps/gulp-sourcemaps.git. The readme file there covers the basic usage of gulp-sourcemaps, available options, and examples. You can also find a list of plugins that support gulp-sourcemaps in the wiki of the GitHub repository.