diff --git a/index.js b/index.js index d1ec474..98bcd0f 100644 --- a/index.js +++ b/index.js @@ -5,11 +5,12 @@ const through = require('through2') module.exports = function (fn) { return through.obj(function (file, enc, cb) { const contents = fn(String(file.contents), file.path, file) || file.contents + const modifiedFile = file.clone() if (file.isBuffer() === true) { - file.contents = new Buffer(contents) + modifiedFile.contents = new Buffer(contents) } - cb(null, file) + cb(null, modifiedFile) }) -} \ No newline at end of file +}