Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Ignores --silent (Fix inside) #69

Closed
bid opened this issue Oct 7, 2014 · 4 comments
Closed

Bug: Ignores --silent (Fix inside) #69

bid opened this issue Oct 7, 2014 · 4 comments

Comments

@bid
Copy link

bid commented Oct 7, 2014

This plugin seems to write to stdout even when you start gulp with --silent!

@bid
Copy link
Author

bid commented Oct 7, 2014

Fixed it:

@@ -10,6 +10,7 @@
 module.exports = function (options) {
    options = assign({}, options || {});
    options.verbose = process.argv.indexOf('--verbose') !== -1;
+   options.silent = process.argv.indexOf('--silent') !== -1;

    var totalBytes = 0;
    var totalSavedBytes = 0;
@@ -78,7 +79,7 @@
        msg += totalFiles === 1 ? 'image' : 'images';
        msg += chalk.gray(' (saved ' + prettyBytes(totalSavedBytes) + ' - ' + percent.toFixed(1).replace(/\.0$/, '') + '%)');

-       gutil.log('gulp-imagemin:', msg);
+       if ( !options.silent ) gutil.log('gulp-imagemin:', msg);
        cb();
    });
 };

@bid bid changed the title Bug: Ignores --silent Bug: Ignores --silent (Fix inside) Oct 7, 2014
@kevva
Copy link
Contributor

kevva commented Oct 7, 2014

This should be handled by gulp itself and not on plugin level.

@kevva kevva closed this as completed Oct 7, 2014
@bid
Copy link
Author

bid commented Oct 7, 2014

"--silent" is one of the official gulp CLI arguments - and it works for every gulp plugin I use except this one. (I've build my own logger and always use that option, so gulps own output doesn't interfere). I haven't checked though, how the other plugin authors handle this option.

Re-reading the code I'd say this should be handled by the log function of gulp-utils. Maybe it should be logged as a bug there?

P.S.: "--verbose" is handled by the plugin too. How is that different?

@sindresorhus
Copy link
Owner

Yes, gulp-util.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants