2createStudio / postcss-sprites

Generate sprites from stylesheets.
MIT License
413 stars 50 forks source link

Disable console warnings #50

Closed niksy closed 8 years ago

niksy commented 8 years ago

Would you consider adding option to disable console warnings (i.e. postcss-sprites: Skip assets/images/image.png because doesn't exist.)? Complicated build processes which contain image URL rewriting before postcss-sprites does it’s work make it really "loud" in CLI :)

niksy commented 8 years ago

Just saw postcss-reporter which collects warnings and errors from plugins so I suppose all console statements could be transfered to PostCSS warn/error methods to make them more flexible?

ianstarz commented 8 years ago

I agree, this will allow us to do things like

var postcss = require('postcss');
var sprites = require('postcss-sprites').default;
var report = require('postcss-reporter');

postcss([ 
  sprites(),
  report({
    filter: function(message) {
      return !/data:image\/.+;base64/.test(message.text);
    }
  })
]);

The base64 image logs are especially noisy as they dump the entire binary out into the console.

ianstarz commented 8 years ago

Here's all it would take https://github.com/ianstarz/postcss-sprites/commit/938ed76b1d5d6419482b032a29cb8bef7dc6a82d

vvasilev- commented 8 years ago

@niksy, @ianstarz sorry for late response but I was busy at work. I will do the transition to Result.warn API to allow easier reporting of the warnings.