Socket
Socket
Sign inDemoInstall

@gulp-sourcemaps/sources-content

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gulp-sourcemaps/sources-content

Gulp plugin for loading or clearing sources content of a sourcemap.


Version published
Weekly downloads
9
decreased by-25%
Maintainers
3
Weekly downloads
 
Created
Source

@gulp-sourcemaps/sources-content

NPM version Downloads Build Status AppVeyor Build Status Coveralls Status

Gulp plugin for loading or clearing sources content of a sourcemap.

Example

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(...))

API

sourcesContent(options)

Takes a object containing options for this plugin.

options.clear

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(...))

License

MIT

Keywords

FAQs

Package last updated on 19 Feb 2019

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