Socket
Socket
Sign inDemoInstall

gulp-sourcemaps

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-sourcemaps

Sourcemap support for gulpjs.


Version published
Weekly downloads
596K
increased by5.33%
Maintainers
3
Weekly downloads
 
Created

What is gulp-sourcemaps?

The gulp-sourcemaps package is a plugin for Gulp that allows you to generate source maps for your files. Source maps are files that map from the transformed source to the original source, enabling you to debug your code more easily by seeing the original source in your browser's developer tools.

What are gulp-sourcemaps's main functionalities?

Initialize Source Maps

This feature initializes the source map generation process. The `sourcemaps.init()` method is called before any transformations are applied to the files, and `sourcemaps.write('.')` writes the source maps to the same directory as the transformed files.

const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');

gulp.task('default', function () {
  return gulp.src('src/**/*.js')
    .pipe(sourcemaps.init())
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('dist'));
});

Write Inline Source Maps

This feature writes the source maps inline within the transformed files. The `sourcemaps.write()` method without any arguments will embed the source map directly into the output file.

const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');

gulp.task('default', function () {
  return gulp.src('src/**/*.js')
    .pipe(sourcemaps.init())
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('dist'));
});

Custom Source Map Path

This feature allows you to specify a custom path for the source maps. The `sourcemaps.write('../maps')` method writes the source maps to a directory named 'maps' that is one level up from the output directory.

const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');

gulp.task('default', function () {
  return gulp.src('src/**/*.js')
    .pipe(sourcemaps.init())
    .pipe(sourcemaps.write('../maps'))
    .pipe(gulp.dest('dist'));
});

Other packages similar to gulp-sourcemaps

Keywords

FAQs

Package last updated on 11 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc