2createStudio / postcss-sprites

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

change warning to log #53

Closed kagawagao closed 8 years ago

kagawagao commented 8 years ago
.spread((root, opts, images, spritesheets) => {
     result.warn(`${spritesheets.length} ${spritesheets.length > 1 ? 'spritesheets' : 'spritesheet'} generated.`);
 })

I think this message just tell us the number of generated spritesheet, it should be simple log, but not a warning. And postcss-reporter and postcss-browser-reporter will collect these message if we treat it as warning

niksy commented 8 years ago

Why is this changed? It messes up with build processes (e.g. gulp-postcss) which would like to filter specific messages or use internal logging mechanism to display messages (e.g gulp-util log). This way you can’t filter messages which display "0 spritesheets generated." or display on which file spritesheet was generated. Yes, it doesn’t make some sense to have this as warning, but it makes it consistent with other messages coming from this plugin. If the only reason is cosmetic change so reporters can ignore this message, you can always use reporters internals to filter these messages.

kagawagao commented 8 years ago

@niksy I also think use console.log will break the consistency of the entire code, and I try to find a better way to solve this, maybe a result.log is a better way, but PostCSS did not provide the this, then I open this issue. This most important is that we can not treat it as a warning or an error, it is just a simple log.

ps. please forgive my poor English 😅

niksy commented 8 years ago

Yes, I agree, it’s a bummer that PostCSS doesn’t have regular logging supported. Maybe issue could be opened for this feature on core project, and if team members agree on this use that, but in the meantime use warn method?

kagawagao commented 8 years ago

this may require @vvasilev- 's agree.

vvasilev- commented 8 years ago

I will revert to Result.warn method to be consistent with the rest of messages in the plugin.