cowboy/grunt — Issue #17: Basic task - CSS minifier
Author: sindresorhus
Created: 2012-01-23 23:05:02+00:00
State: open

I've created a [simple basic task](https://github.com/sindresorhus/sindresorhus.github.com/blob/master/grunt.js) that will minify (also concat if multiple) CSS files using [sqwish](https://github.com/ded/sqwish).

Running this on my site CSS shrinks it to half.

```javascript
task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function( data, name ) {
var files = file.expand( data );
var max = task.helper( 'concat', files );
var min = require('sqwish').minify( max, config('sqwish').strict );
file.write( name, min );
if ( task.hadErrors() ) {
return false;
}
log.writeln( 'File "' + name + '" created.' );
task.helper( 'min_max_info', min, max );
});
```

Feel free to steal if you want it ;)