gruntjs / grunt

Grunt: The JavaScript Task Runner
http://gruntjs.com/
Other
12.27k stars 1.5k forks source link

All Tasks should have output formatting consistency #697

Open dominicbarnes opened 11 years ago

dominicbarnes commented 11 years ago

I have a proposal for grunt and the family of grunt-contrib-* plugins. (and even beyond to 3rd-party plugins) When running tasks, there's no agreed-upon standard for outputting log data. For example, destination/output files are output in cyan by the less task while concat simply wraps the value in quotes and compass does nothing. It would be great if at least the official plugins could agree upon a "style guide" for outputting specific bits of data in their output.

In addition, this "style guide" can either be published in documentation for plugin developers to optionally include in their tasks, or perhaps an API of sorts could be exposed as methods on grunt.log and friends.

Some examples of what I mean exactly:

Does anyone else have any thoughts on something like this? I think this could definitely improve the readability of grunt-powered build processes (especially fairly complex/large ones that I currently maintain) and could very well be "low-hanging fruit".

darsain commented 11 years ago

I was already asking for some task output guidelines on #grunt several times. I definitely support this, as each task right now has a different style, and the output looks really chaotic.

If nothing else, grunt should define a colors.js theme:

var colors = require('colors');
colors.setTheme({
  input: ...,
  verbose: ...,
  prompt: ...,
  info: ...,
  data: ...,
  help: ...,
  warn: ...,
  debug: ...,
  error: ...
});

and enforce it's usage among tasks. This theme could be than configurable in initConfig with 2 presets for light/dark console backgrounds.

Also having rules like 'do not output anything in non --verbose mode', etc ... (depending on what would be the consensus) would be awesome.

Basically a docs page with task output style and formatting guidelines.

OliverJAsh commented 11 years ago

+1

pvoisin commented 11 years ago

Definitely!

tkellen commented 11 years ago

Just popping in to say that we'll be able to approach something like this when node-task is complete.