vinyl-sourcemaps-apply
    Overview
    Documentation
    Insights
    Code
    Contributors
    Dependencies
    Alternatives

vinyl-sourcemaps-apply

Apply a source map to a vinyl file, merging it with preexisting source maps

0.2.1  •  Updated 4 years ago  •  by gulp-sourcemaps  •  ISC License

Apply a source map to a vinyl file, merging it with preexisting source maps.

Usage:

var applySourceMap = require('vinyl-sourcemaps-apply');
applySourceMap(vinylFile, sourceMap);

Example (Gulp plugin):

var through = require('through2');
var applySourceMap = require('vinyl-sourcemaps-apply');
var myTransform = require('myTransform');

module.exports = function(options) {

  function transform(file, encoding, callback) {
    // generate source maps if plugin source-map present
    if (file.sourceMap) {
      options.makeSourceMaps = true;
    }

    // do normal plugin logic
    var result = myTransform(file.contents, options);
    file.contents = new Buffer(result.code);

    // apply source map to the chain
    if (file.sourceMap) {
      applySourceMap(file, result.map);
    }

    this.push(file);
    callback();
  }

  return through.obj(transform);
};
How often do you use dark themes on other websites?

Popularity

Weekly Downloads
851.3K
Stars
17

Maintenance

Development

Last ver 4 years ago
Created 6 years ago
Last commit 4 years ago
2 months between commits

Technology

Node version: 0.12.7
0 unpacked

Compliance

ISC License
OSI Approved
0 vulnerabilities

Contributors

2 contributors
Florian Reiterer
Maintainer, 7 commits, 1 merges
Rogier Schouten
1 commits, 1 PRs
Works at SpiritIT
Florian Reiterer
1 commits
Corey Farrell
Maintainer
Works at CFWare, LLC
nmccready
Maintainer
Blaine Bublitz
Maintainer
Works at Paying the maintainers Tidelift

Dependencies

Tags

vinyl
sourcemaps
source maps
gulp
Ready for the next level?
Join Openbase's founding team to help us build the ultimate open-source app store, work with the latest technologies, and enjoy great culture, impact and autonomy
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
© 2020 Devstore, Inc.