You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
452 B
20 lines
452 B
2 years ago
|
'use strict';
|
||
|
var through = require('through2');
|
||
|
var minify = require('./lib/minify');
|
||
|
|
||
|
module.exports = function(uglify, logger) {
|
||
|
return function(opts) {
|
||
|
var minifier = minify(uglify, logger)(opts);
|
||
|
return through.obj(function(file, encoding, callback) {
|
||
|
var newFile = null;
|
||
|
var err = null;
|
||
|
try {
|
||
|
newFile = minifier(file);
|
||
|
} catch (e) {
|
||
|
err = e;
|
||
|
}
|
||
|
callback(err, newFile);
|
||
|
});
|
||
|
};
|
||
|
};
|