grunt-contrib-cssmin v4.0.0
Minify CSS
Getting Started
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-contrib-cssmin --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-contrib-cssmin');
Issues with the output should be reported on the clean-css issue tracker.
Cssmin task
Run this task with the grunt cssmin
command.
Options
Options are passed to clean-css. In addition this task defines some extra options:
report
Type: string
Choices: 'min'
, 'gzip'
Default: 'min'
Report minification result or both minification and gzip results.
This is useful to see exactly how well clean-css is performing but using 'gzip'
will make the task take 5-10x longer to complete. Example output.
sourceMap
Type: boolean
Choices: true
, false
Default: false
Enable Source Maps.
Usage
Combine two files into one output file
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
'output.css': ['foo.css', 'bar.css']
}
}
}
.min.css
extension
Minify all contents of a release directory and add a cssmin: {
target: {
files: [{
expand: true,
cwd: 'release/css',
src: ['*.css', '!*.min.css'],
dest: 'release/css',
ext: '.min.css'
}]
}
}
Release History
- 2023-05-01βββv5.0.0βββUpdate dependencies. Drop Node.js < 14 support.
- 2021-02-15βββv4.0.0βββUpdate all dependencies including clean-css v5.x. Drop Node.js < 10 support.
- 2018-09-07βββv3.0.0βββUpdate all dependencies. Drop Node.js < 6 support.
- 2017-07-27βββv2.2.1βββFix issue with
relativeTo
for clean-css v4.x. - 2017-05-10βββv2.2.0βββUpdate clean-css to v4.1.1.
- 2017-04-17βββv2.1.0βββSet required Node.js version to >=4 since clean-css 4.x requires that.
- 2017-02-02βββv2.0.0βββUpdate clean-css to v4.0.3.
- 2016-08-31βββv1.0.2βββFix issues for node 6.
- 2016-03-16βββv1.0.1βββDowngrade maxmin to support Node.js 0.10.
- 2016-03-04βββv1.0.0βββUpdated docs. Point main to task and removed peerDeps. Update clean-css to v3.4.1.
- 2015-09-15βββv0.14.0βββBump to cssmin ~3.4.0. Minor test fixes.
- 2015-07-27βββv0.13.0βββBump to cssmin ~3.3.0.
- 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 tofalse
by default. - 2015-02-09βββv0.12.0βββAdd
sourceMap
option. - 2014-12-24βββv0.11.0βββBump
clean-css
to 3.0.1. Removebanner
option. - 2014-06-11βββv0.10.0βββUpdate clean-css v2.2.0.
- 2014-02-01βββv0.9.0βββRefactor. Remove grunt-lib-contrib dependency. Backwards-compatibly remove
false
choice fromreport
. - 2014-02-14βββv0.8.0βββUpdate clean-css v2.1.0.
- 2013-11-23βββv0.7.0βββUpdate clean-css v2.0.0.
- 2013-09-14βββv0.6.2βββSupport relative URLs via clean-css ~1.1.1.
- 2013-05-25βββv0.6.1βββSupport import in-lining via clean-css ~1.0.4.
- 2013-04-05βββv0.6.0βββUpdate clean-css dependency to ~1.0.0.
- 2013-03-14βββv0.5.0βββSupport for
report
option (false by default). - 2013-03-10βββv0.4.2βββAdd
banner
option. Support clean-csskeepSpecialComments
. - 2013-02-17βββv0.4.1βββUpdate clean-css dependency to ~0.10.0.
- 2013-02-15βββv0.4.0βββFirst official release for Grunt 0.4.0.
- 2013-01-23βββv0.4.0rc7βββUpdating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
- 2013-01-09βββv0.4.0rc5βββUpdating to work with grunt v0.4.0rc5. Switching to
this.files
API. - 2012-11-01βββv0.3.2βββUpdate clean-css dep.
- 2012-10-12βββv0.3.1βββRename grunt-contrib-lib dep to grunt-lib-contrib.
- 2012-09-23βββv0.3.0βββOptions no longer accepted from global config key.
- 2012-09-10βββv0.2.0βββRefactored from grunt-contrib into individual repo.
Task submitted by Tim Branyen
This is a generated file.