Bachir Soussi Chiadmi cefd1c2ad0 updated sys and created publi | %!s(int64=6) %!d(string=hai) anos | |
---|---|---|
.. | ||
.jshintrc | %!s(int64=7) %!d(string=hai) anos | |
.npmignore | %!s(int64=7) %!d(string=hai) anos | |
README.md | %!s(int64=7) %!d(string=hai) anos | |
index.js | %!s(int64=7) %!d(string=hai) anos | |
package.json | %!s(int64=6) %!d(string=hai) anos |
Apply a source map to a vinyl file, merging it with preexisting source maps.
var applySourceMap = require('vinyl-sourcemaps-apply');
applySourceMap(vinylFile, sourceMap);
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);
};