grunt-csso

Minify CSS files with CSSO.

npm install grunt-csso
128 downloads in the last day
710 downloads in the last week
3 324 downloads in the last month

grunt-csso v0.6.1

Build Status NPM version Dependency Status devDependency Status

Minify CSS files with CSSO.

Getting Started

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.

CSSO task

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.

Options

restructure

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.

report

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.

Usage Examples

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']
    }
  }
}

Minify all contents of a release directory and add a .min.css extension

csso: {
  dynamic_mappings: {
    expand: true,
    cwd: '/css/',
    src: ['*.css', '!*.min.css'],
    dest: 'dest/css/',
    ext: '.min.css'
  }
}

Release History

  • 2014/03/18 - v0.6.1 - Bug fix several bugs.
  • 2014/03/02 - v0.6.0 - Update dependencies modules.
  • 2013/12/19 - v0.5.3 - Bump v0.5.3
  • 2013/11/25 - v0.5.2 - Bump v0.5.2
  • 2013/11/25 - v0.5.1 - Update CSSO.
  • 2013/03/26 - v0.5.0 - Add 'report' option (false by default).
  • 2013/02/25 - v0.4.1 - Add 'banner' option.
  • 2013/02/17 - v0.4.0 - Support compatibility with Grunt 0.4.
  • 2013/01/17 - v0.3.0 - Improve file handling.
  • 2012/10/20 - v0.2.1 - Fix function to remove unnecessary argument.
  • 2012/10/20 - v0.2.0 - Changed CSSO task from the command line to from the npm module.
  • 2012/10/15 - v0.1.1 - Added keyword "gruntplugin" to package.json.
  • 2012/10/14 - v0.1.0 - Initial release.

Contributors

Many thanks!

License

Code is released under the MIT license.

Bitdeli Badge

npm loves you