grunt-contrib-cssmin
Advanced tools
Comparing version 0.12.2 to 0.12.3
{ | ||
"name": "grunt-contrib-cssmin", | ||
"description": "Minify CSS", | ||
"version": "0.12.2", | ||
"version": "0.12.3", | ||
"author": { | ||
@@ -23,5 +23,5 @@ "name": "Grunt Team", | ||
"dependencies": { | ||
"chalk": "^0.5.1", | ||
"clean-css": "^3.0.1", | ||
"maxmin": "^1.0.0" | ||
"chalk": "^1.0.0", | ||
"clean-css": "^3.1.0", | ||
"maxmin": "^1.1.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "devDependencies": { |
@@ -1,2 +0,2 @@ | ||
# grunt-contrib-cssmin v0.12.2 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-cssmin.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-cssmin) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/ntgfqc3ppk533m84/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-cssmin/branch/master) | ||
# grunt-contrib-cssmin v0.12.3 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-cssmin.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-cssmin) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/ntgfqc3ppk533m84/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-cssmin/branch/master) | ||
@@ -90,2 +90,3 @@ > Minify CSS | ||
* 2015-05-09 v0.12.3 Improve reporting of errors and warnings. Log out written files and the saved size. Fix absolute paths. | ||
* 2015-02-20 v0.12.2 Set the `rebase` option to `false` by default. | ||
@@ -116,2 +117,2 @@ * 2015-02-09 v0.12.0 Add `sourceMap` option. | ||
*This file was generated on Fri Feb 20 2015 15:41:27.* | ||
*This file was generated on Sat May 09 2015 12:09:52.* |
'use strict'; | ||
var path = require('path'); | ||
var util = require('util'); | ||
var CleanCSS = require('clean-css'); | ||
@@ -13,5 +15,4 @@ var chalk = require('chalk'); | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
return true; | ||
}); | ||
@@ -21,2 +22,11 @@ }; | ||
grunt.registerMultiTask('cssmin', 'Minify CSS', function () { | ||
var created = { | ||
maps: 0, | ||
files: 0 | ||
}; | ||
var size = { | ||
before: 0, | ||
after: 0 | ||
}; | ||
this.files.forEach(function (file) { | ||
@@ -33,8 +43,22 @@ var options = this.options({ | ||
options.target = file.dest; | ||
options.relativeTo = path.dirname(availableFiles[0]); | ||
try { | ||
compiled = new CleanCSS(options).minify(availableFiles); | ||
if (compiled.errors.length) { | ||
grunt.warn(compiled.errors.toString()); | ||
return; | ||
} | ||
if (compiled.warnings.length) { | ||
grunt.log.error(compiled.warnings.toString()); | ||
} | ||
if (options.debug) { | ||
grunt.log.writeln(util.format(compiled.stats)); | ||
} | ||
} catch (err) { | ||
grunt.log.error(err); | ||
grunt.warn('CSS minification failed'); | ||
grunt.warn('CSS minification failed at ' + availableFiles + '.'); | ||
} | ||
@@ -48,5 +72,8 @@ | ||
size.before += unCompiledCssString.length; | ||
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'); | ||
@@ -56,5 +83,18 @@ } | ||
grunt.file.write(file.dest, compiledCssString); | ||
created.files++; | ||
size.after += compiledCssString.length; | ||
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. ' + chalk.dim(maxmin(size.before, size.after))); | ||
} else { | ||
grunt.log.warn('No files created.'); | ||
} | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10305
77
117
- Removedansi-regex@0.2.1(transitive)
- Removedansi-styles@1.1.0(transitive)
- Removedchalk@0.5.1(transitive)
- Removedhas-ansi@0.1.0(transitive)
- Removedstrip-ansi@0.3.0(transitive)
- Removedsupports-color@0.2.0(transitive)
Updatedchalk@^1.0.0
Updatedclean-css@^3.1.0
Updatedmaxmin@^1.1.0