Skip to content

Commit

Permalink
Use Recess formatting on parse error messages too. Closes sindresorhus#5
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 3, 2012
1 parent 5fbda4d commit 3a2bbc4
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions tasks/recess.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function( grunt ) {
'use strict';

grunt.registerMultiTask('recess', 'Grunt plugin to lint and minify CSS or LESS.', function() {
grunt.registerMultiTask('recess', 'Lint and minify CSS and LESS', function() {
var recess = require('recess');
var lf = grunt.utils.linefeed;
var cb = this.async();
Expand All @@ -23,23 +23,15 @@ module.exports = function( grunt ) {
// https://github.com/twitter/recess/issues/42
data = Array.isArray( data ) ? data.reverse() : [ data ];

if ( err ) {
grunt.fail.fatal( err );
}

data.forEach(function( item ) {
if ( item.errors.length ) {
grunt.fail.warn( item.errors.join('') );
}

if ( item.options.compile ) {
min.push( item.output );
max.push( item.data );
// Extract status and check
} else if ( item.output[1].indexOf('Perfect!') !== -1 ) {
grunt.log.writeln( item.output.join( lf ) );
} else {
grunt.fail.warn( lf + item.output.join( lf ) );
grunt.fail.warn( item.output.join( lf ) );
}
});

Expand All @@ -53,7 +45,7 @@ module.exports = function( grunt ) {
grunt.helper( 'min_max_info', min.join( separator ), max.join( separator ) );
}
} else {
grunt.fail.fatal('No destination specified. This is required when enabling options.compile.');
grunt.fail.fatal('No destination specified. Required when options.compile is enabled.');
}
}

Expand Down

0 comments on commit 3a2bbc4

Please sign in to comment.