vinyl-sourcemaps-apply

WebJar for vinyl-sourcemaps-apply

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

vinyl-sourcemaps-apply
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

vinyl-sourcemaps-apply
WebJar for vinyl-sourcemaps-apply
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/floridoo/vinyl-sourcemaps-apply

Download vinyl-sourcemaps-apply

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/vinyl-sourcemaps-apply/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>vinyl-sourcemaps-apply</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/vinyl-sourcemaps-apply/
implementation 'org.webjars.npm:vinyl-sourcemaps-apply:0.2.1'
// https://jarcasting.com/artifacts/org.webjars.npm/vinyl-sourcemaps-apply/
implementation ("org.webjars.npm:vinyl-sourcemaps-apply:0.2.1")
'org.webjars.npm:vinyl-sourcemaps-apply:jar:0.2.1'
<dependency org="org.webjars.npm" name="vinyl-sourcemaps-apply" rev="0.2.1">
  <artifact name="vinyl-sourcemaps-apply" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='vinyl-sourcemaps-apply', version='0.2.1')
)
libraryDependencies += "org.webjars.npm" % "vinyl-sourcemaps-apply" % "0.2.1"
[org.webjars.npm/vinyl-sourcemaps-apply "0.2.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : source-map jar [0.5.1,0.6)

Project Modules

There are no modules declared in this project.

vinyl-sourcemaps-apply

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);
};

Versions

Version
0.2.1
0.1.4