Skip to content

Commit

Permalink
Merge pull request #199 from philippsimon/master
Browse files Browse the repository at this point in the history
fix #185 - report not shown
  • Loading branch information
vladikoff committed Mar 27, 2015
2 parents 260342e + 936caeb commit 7f07091
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tasks/cssmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ module.exports = function (grunt) {
};

grunt.registerMultiTask('cssmin', 'Minify CSS', function () {
var created = {
maps: 0,
files: 0
};

this.files.forEach(function (file) {
var options = this.options({
rebase: false,
Expand Down Expand Up @@ -45,11 +50,23 @@ module.exports = function (grunt) {
if (options.sourceMap) {
compiledCssString += '\n' + '/*# sourceMappingURL=' + path.basename(file.dest) + '.map */';
grunt.file.write(file.dest + '.map', compiled.sourceMap.toString());
created.maps++;
grunt.verbose.writeln('File ' + chalk.cyan(file.dest + '.map') + ' created');
}

grunt.file.write(file.dest, compiledCssString);
created.files++;
grunt.verbose.writeln('File ' + chalk.cyan(file.dest) + ' created ' + chalk.dim(maxmin(unCompiledCssString, compiledCssString, options.report === 'gzip')));
}, this);

if (created.maps > 0) {
grunt.log.ok(created.maps + ' source' + grunt.util.pluralize(this.files.length, 'map/maps') + ' created.');
}

if (created.files > 0) {
grunt.log.ok(created.files + ' ' + grunt.util.pluralize(this.files.length, 'file/files') + ' created.');
} else {
grunt.log.warn('No files created.');
}
});
};

0 comments on commit 7f07091

Please sign in to comment.