grunt-csso

Minify CSS files with CSSO.

grunt-csso v0.7.0

Minify CSS files with CSSO.

This plugin requires Grunt >=0.4.0

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-csso --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of js:

grunt.loadNpmTasks('grunt-csso');

This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade.

Run this task with the grunt csso command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Files are compressed with csso.

Type: Boolean
Default: true

You can turns structural optimizations off.

Type: String
Default: null

Prefix the compressed source with the given banner, with a linebreak inbetween.

Choise: false, 'min', 'gzip'
Default: false

Either report only minification result or report 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.

csso: {
  compress: {
    options: {
      report: 'gzip'
    },
    files: {
      'output.css': ['input.css']
    }
  },
  restructure: {
    options: {
      restructure: false,
      report: 'min'
    },
    files: {
      'restructure.css': ['input.css']
    }
  },
  banner: {
    options: {
      banner: '/* Copyleft */'
    },
    files: {
      'banner.css': ['input.css']
    }
  },
  shortcut: {
    src: 'override.css'
  }
}
csso: {
  dynamic_mappings: {
    expand: true,
    cwd: '/css/',
    src: ['*.css', '!*.min.css'],
    dest: 'dest/css/',
    ext: '.min.css'
  }
}

Code is released under the MIT license.