forked from sindresorhus/gulp-strip-debug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (23 loc) · 620 Bytes
/
index.js
File metadata and controls
27 lines (23 loc) · 620 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var stripDebug = require('strip-debug');
module.exports = function () {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
cb(null, file);
return;
}
if (file.isStream()) {
cb(new gutil.PluginError('gulp-strip-debug', 'Streaming not supported'));
return;
}
try {
file.contents = new Buffer(stripDebug(file.contents.toString()).toString());
this.push(file);
} catch (err) {
this.emit('error', new gutil.PluginError('gulp-strip-debug', err, {fileName: file.path}));
}
cb();
});
};