Skip to content

Commit

Permalink
fix(minify): log warnings to gulplog
Browse files Browse the repository at this point in the history
If warnings are enabled, log them to the gulplog. The logging (and the
level of logging) will then be controlled by the gulp cli.

Fixes #163.
  • Loading branch information
terinjokes committed May 16, 2017
1 parent 4cc8751 commit dbbba30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -37,10 +37,8 @@ the UglifyJS API are supported. There are a few exceptions:

1. The `sourceMap` option must not be set, as it will be automatically configured
based on your Gulp configuration. See the documentation for [Gulp sourcemaps][gulp-sm].
2. Setting the `warnings` option has no visible affect. [See #163](gh-163).

[gulp-sm]: https://github.com/gulp-sourcemaps/gulp-sourcemaps#usage
[gh-163]: https://github.com/terinjokes/gulp-uglify/issues/163

## Errors

Expand Down
6 changes: 6 additions & 0 deletions minifier.js
Expand Up @@ -57,6 +57,12 @@ module.exports = function(opts, uglify) {
);
}

if (mangled.warnings) {
mangled.warnings.forEach(function(warning) {
log.warn('gulp-uglify [%s]: %s', file.relative, warning);
});
}

file.contents = new Buffer(mangled.code);

if (file.sourceMap) {
Expand Down

0 comments on commit dbbba30

Please sign in to comment.