Skip to content

Commit

Permalink
Tweak error messages.
Browse files Browse the repository at this point in the history
When something fails, use `grunt.fail.warn`.
  • Loading branch information
XhmikosR committed Oct 3, 2014
1 parent 22bbb42 commit 3657ae5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tasks/uncss.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,24 @@ module.exports = function ( grunt ) {
var src = f.src.filter(function ( filepath ) {
// Warn on and remove invalid source files (if nonull was set).
if ( !grunt.file.exists( filepath ) ) {
grunt.log.warn( 'Source file "' + filepath + '" not found.' );
grunt.log.warn( 'Source file ' + chalk.cyan( filepath ) + ' not found.' );
return false;
} else {
return true;
}
});

if ( src.length === 0 ) {
grunt.fail.warn( 'Destination (' + f.dest + ') not written because src files were empty.' );
}

f.orig.src.forEach(function (source) {
if (/^https?/.test(source)) {
src.push(source);
options.urls.push(source);
}
});

if ( src.length === 0 ) {
grunt.log.warn( 'Destination (' + f.dest + ') not written because src files were empty.' );
return;
}

try {
uncss( src, options, function ( error, output, report ) {
if ( error ) {
Expand Down

0 comments on commit 3657ae5

Please sign in to comment.